mixle.inference.simulate module¶
Turn a fitted model into a reusable simulator with scenarios.
A fitted generative model already has sampling behavior. simulate()
packages that behavior into a Simulator that can produce baseline
synthetic data and, for learned Bayesian networks, named intervention
scenarios.
Non-graph models simulate from their baseline distribution. Interventions
require the causal structure exposed by
HeterogeneousBayesianNetwork.
- class Scenario(name, interventions=<factory>)[source]
Bases:
objectA named simulation condition: which fields are clamped to which values (an intervention).
- name: str
- class Simulator(model)[source]
Bases:
objectA fitted model packaged as a data generator, runnable under a baseline or named scenarios.
- Parameters:
model (Any)
- scenario(name, interventions)[source]
Register a named intervention scenario (requires a learned Bayesian network to apply).
- run(n=100, *, scenario=None, interventions=None, seed=0)[source]
Generate
nsynthetic records under the baseline, a registeredscenario, or ad-hocinterventions.
- outcome_mean(field_index, *, scenario=None, n=2000, seed=0)[source]
The mean of a numeric field under a scenario – the quantity to compare across conditions.