v1.0.1
Core Conceptsv1.0.1
Transitions & Dynamics
Stationary transition probability matrices and dynamic rule evaluation.
Transitions dictate how agents migrate between states at each interaction step.
Transition Probability Matrices
A stationary transition matrix is represented as a 2D NumPy array of shape (K, K), where each row must sum to 1.0:
matrix_example.py
import numpy as np
from behaviorsim import Simulator, State
states = [State("A"), State("B")]
# Row 0: Transitions from A -> [A (80%), B (20%)]
# Row 1: Transitions from B -> [A (10%), B (90%)]
matrix = np.array([
[0.8, 0.2],
[0.1, 0.9]
])
sim = Simulator(states=states, transition_matrix=matrix)Dynamic Transition Rules
Real behaviors are frequently non-stationary: an agent transitions only when a metric crosses a threshold. BehaviorSim supports TransitionRule objects that evaluate conditions over historical feature values.
Supported Operators & Aggregations
Comparison Operators
<, <=, >, >=, ==, !=
Historical Aggregations
last, sum, max, mean, min