v1.0.1
Getting Startedv1.0.1
Quickstart Guide
Generate your first sequential behavioral dataset in Python in under two minutes.
This guide demonstrates how to instantiate a simulator from a built-in domain preset, generate multi-agent sequences, and inspect the resulting pandas DataFrame.
Your First Simulation
quickstart.py
1234567891011121314from behaviorsim import Simulator # 1. Instantiate from the built-in finance preset sim = Simulator.from_preset("finance") # 2. Generate 50 interactions across 5 distinct sequence trajectories df = sim.generate( num_interactions=50, num_sequences=5, seed=42 ) # 3. Print the first few rows print(df.head())
Understanding the Code
Simulator.from_preset("finance"): Constructs a pre-calibrated simulator with states (Stable,Active,Volatile,Drawdown,Recovered,Closed), transition matrices, and feature emission rules.sim.generate(...): Executes the simulation loop.num_interactions: Number of steps per sequence (default: 100).num_sequences: Number of independent agent trajectories (default: 1).seed: Integer random seed for bitwise reproducibility.
Inspecting Output Traces
The returned object is a standard pandas.DataFrame containing:
| Column | Type | Description |
|---|---|---|
| profile | string | Active agent archetype (e.g. "balanced_investor") |
| sequence_id | int | Unique trajectory identifier |
| interaction_id | int | Ordered step index (0, 1, 2, ...) within the sequence |
| state | string | Active discrete behavioral state at this step |
| portfolio_value, etc. | float / int | Observable parametric emissions sampled from active state |
Deterministic Reproducibility
Running the script above with seed=42 will always generate the exact same values on any machine, making test cases and benchmark evaluations completely reliable.