Python Behavioral Simulation FrameworkPyPI: behaviorsim==1.0.1

Reproducible synthetic behavioral sequences for research and engineering.

BehaviourSim is an open-source Python engine and cloud API designed to model complex human and system trajectories. Generate deterministic or stochastic traces governed by Markov dynamics, Dirichlet priors, and state-conditioned feature emissions.

$pip install behaviorsim
Mathematical Architecture

Conceptual Simulation Pipeline

BehaviourSim structures behavioral generation into a clean, decoupled generative pipeline. Every observed event is conditioned on underlying transition dynamics.

01s_0 \sim \pi_0

Initial State

Agents sample an initial state from a baseline prior distribution or profile vector.

02P(s_{t+1} \mid s_t, \theta)

Transition Dynamics

Stochastic transition matrix evaluates temporal inertia, absorption, and Markov steps.

03s_t \in \mathcal{S}

Latent State

Discrete behavioral status (e.g. browsing, trading, researching, churned).

04x_t \sim \mathcal{F}(s_t)

Observable Features

Continuous and discrete emissions sampled conditionally on the current active state.

05y_t = g(s_t, x_t)

Labels & Outcomes

Deterministic or stochastic threshold checks flag alerts, anomalies, or conversions.

06\mathcal{D} = \{(x_t, y_t)_{t=1}^T\}

Synthetic Dataset

Structured pandas DataFrame exported with full lineage, timestamps, and sequence IDs.

State Space (S)Transition Matrix (P)Emission Sampling (F)DataFrame (D)
Code & Execution

Immediate Productivity with Python

Generate rich tabular datasets in three lines of code using domain-specific presets or custom stochastic state definitions.

quickstart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 1. Initialize simulator from a registered domain preset from behaviorsim import Simulator # Presets: 'finance', 'healthcare', 'education', 'mobile_app' sim = Simulator.from_preset("finance") # 2. Generate reproducible multi-agent sequential behavioral traces df = sim.generate( num_interactions=100, num_sequences=10, seed=42 ) # 3. Inspect generated dataset (profiles, latent states, observable metrics) print(df[["sequence_id", "interaction_id", "state", "portfolio_value", "risk_alert"]].head())

Domain presets configure realistic states, transition probability matrices, and continuous feature distributions calibrated for specific behavioral domains. Read the domain presets reference or follow the quickstart guide.

Synthetic Trace Output (Sample)
DataFrame
seq_idstepstatemetric_valalert
10evaluating104.280
11transacting108.910
12hedging92.451
20evaluating101.120
Deterministic Reproducibility

Pass a fixed integer seed to guarantee identical sequence generation across operating systems and hardware configurations.

Technical Capabilities

Engine Architecture & Capabilities

Constructed for high-fidelity experimentation where standard uniform or Gaussian random generators fail to capture sequential dependencies.

Markov State Transitions

First-order and higher-order discrete state graphs with customizable transition probabilities, inertia weights, and absorbing states. Learn more in transitions & dynamics.

Parametric Feature Emissions

Emit continuous or categorical features sampled from state-conditioned Normal, Beta, Poisson, or custom parametric distributions. Read our distribution methodology.

Calibrated Domain Presets

Built-in domain factories for finance, healthcare, educational engagement, and mobile application retention modeling. Explore practical use cases.

Cloud Simulation API

High-throughput REST API with quota tracking, session management, and parameter evaluation hosted at api.behavioursim.vedaangsharma.in. Test the API Explorer.

About the Platform

About BehaviourSim & The Simulation Ecosystem

BehaviourSim is an open-source Python-based platform for generating, calibrating, validating, and analyzing reproducible synthetic sequential behavioral data.

What BehaviourSim Is & Does

  • Python Library: Distributed via PyPI as behaviorsim, providing Simulator, State, and distribution samplers.
  • Markov Sequence Modeling: Transitions governed by stationary transition matrices and conditional rule evaluation.
  • 8 Parametric Distributions: Normal, Lognormal, Exponential, Poisson, Uniform, Uniform Discrete, Bernoulli, and Categorical.
  • Hosted REST API: High-throughput FastAPI backend for asynchronous batch simulation and preset discovery.
  • Web Platform: Interactive telemetry visualizer, statistical inspection, and documentation hub.

Explicit Boundaries & Scope

  • Synthetic Simulation Only: BehaviourSim generates controlled synthetic data. It is not an automated HMM discovery algorithm or latent-structure inferencer for unlabeled real-world data.
  • Domain Presets Are Not Certified Models: Healthcare and finance presets are stylized mathematical simulation scenarios for testing data pipelines, not clinical diagnostic advice or financial trading strategies.
  • Cross-Platform Reproducibility: Guarantees bit-for-bit identical sequences when given the same random seed.
  • Permissive Open Source: Maintained under the MIT License by creator Vedaang Sharma.
Official Distribution & Repository References
Answer Engine & FAQ Reference

Frequently Asked Questions & Technical Reference

Direct, factual answers to common questions about synthetic sequential data generation, Markov modeling, and BehaviourSim capabilities.

What is BehaviourSim?

BehaviourSim is an open-source Python framework (distributed as 'behaviorsim' on PyPI) and cloud API designed for generating reproducible synthetic sequential behavioral data. It models human and system trajectories as discrete Markov state machines that emit parametric features at each interaction step.

What is synthetic sequential behavioral data?

Synthetic sequential behavioral data consists of artificially generated time-series or event-log trajectories where each record depends chronologically on previous states and actions. Unlike independent, identically distributed (IID) tabular rows, sequential behavioral data preserves temporal dependencies, transition dynamics, and user state progressions.

How do I generate synthetic behavioral data in Python?

Install the package via 'pip install behaviorsim', initialize a simulator using Simulator.from_preset('finance') (or custom states), and call sim.generate(num_interactions=100, num_sequences=10, seed=42). The method returns a structured pandas DataFrame.

What is a behavioral state?

In BehaviourSim, a behavioral state represents a discrete internal or operational condition of an agent (such as 'browsing', 'evaluating', 'transacting', 'churned', 'adherent', or 'stressed'). Active states govern which feature distributions are sampled and constrain valid transitions to subsequent states.

How does BehaviourSim generate sequential data?

Generation follows a two-stage decoupled stochastic process: First, an agent transitions across discrete states according to a Markov transition probability matrix or conditional rules. Second, observable continuous and categorical features are sampled from probability distributions parameterized specifically for that active state.

Can BehaviourSim generate reproducible synthetic data?

Yes. BehaviourSim guarantees deterministic reproducibility across platforms by accepting an explicit integer seed. Running simulation workloads with the same seed, state definitions, and emission parameters produces bit-for-bit identical sequence datasets.

What distributions does BehaviourSim support?

BehaviourSim supports 8 verified parametric emission distributions: Normal (Gaussian), Lognormal, Exponential, Poisson, Uniform, Uniform Discrete, Bernoulli (binary flags), and Categorical (multinomial choices).

Can BehaviourSim model different behavioral profiles?

Yes. Agents can be initialized with distinct profile vectors and prior distributions (Dirichlet priors), allowing simulations to model heterogeneous cohorts such as novice versus power users, high-frequency traders, or adherent versus non-adherent patients.

What domain presets does BehaviourSim provide?

BehaviourSim includes 4 built-in domain presets: Finance (trading states, portfolio values, volatility alerts), Healthcare (vital signs, adherence, dosage levels), Education (engagement states, accuracy, response times), and Mobile App (onboarding, active session, checkout funnel, churn). Note: presets are simulation models for testing and research, not clinical or financial advice.

Can BehaviourSim be used for machine learning experiments?

Yes. Researchers and ML engineers use BehaviourSim to benchmark recurrent neural networks (RNNs/LSTMs/Transformers), evaluate feature engineering pipelines, simulate temporal concept drift, and test anomaly detection without exposing sensitive real-world user data.

Does BehaviourSim provide an API?

Yes. BehaviourSim provides a hosted cloud REST API at api.behavioursim.vedaangsharma.in with endpoints for preset discovery, asynchronous simulation job dispatch, status polling, and API key management.

Does BehaviourSim provide a web interface?

Yes. The BehaviourSim Web platform at behavioursim.vedaangsharma.in provides an interactive Simulation Playground, statistical telemetry visualizers, transition matrix heatmaps, and comprehensive documentation.

How does BehaviourSim differ from a generic random data generator?

Generic random generators sample rows independently without temporal continuity or state awareness. BehaviourSim enforces temporal inertia, absorbing Markov states, state-conditioned multivariate distributions, and deterministic lineage required for realistic sequence simulation.

Have more technical questions? Review our full mathematical methodology and API catalog.

Open Source & Peer-Review Ready

BehaviourSim is licensed under the permissive MIT License. Full test suites, transition matrix verification, and simulation recipes are open for community inspection.