dotime.RegimeSwitchingTemporalSCM
- class dotime.RegimeSwitchingTemporalSCM(dags, mechanisms, noise, transition_matrix, device=device(type='cpu'), dtype=torch.float32)[source]
Bases:
objectRegime-switching temporal SCM.
At each time step, a discrete regime variable d_t ∈ {0,…,R-1} determines which causal structure and mechanisms are active:
X_t^(i) = f_i^(d_t)(Pa_{G^(d_t)}(X_t^(i))) + ε_t^(i)
Regime transitions follow a Markov chain: d_t ~ Categorical(P[d_{t-1}, :])
- Parameters:
- __init__(dags, mechanisms, noise, transition_matrix, device=device(type='cpu'), dtype=torch.float32)[source]
- Parameters:
dags (List[TemporalDAG]) – List of temporal DAGs, one per regime.
mechanisms (List[Dict[str, TemporalMechanism]]) – List of mechanism dictionaries, one per regime.
noise (Dict[str, DistributionSampler]) – Noise distributions (shared across regimes).
transition_matrix (np.ndarray) – Regime transition matrix P of shape (R, R).
device (torch.device) – Device for computation.
dtype (torch.dtype) – Data type.
Methods
__init__(dags, mechanisms, noise, ...[, ...])sample_interventional(T, intervention[, ...])Sample interventional data with regime switching.
sample_observational(T[, burn_in, ...])Sample observational data with regime switching.
- sample_observational(T, burn_in=50, generator=None, return_regimes=False)[source]
Sample observational data with regime switching.
- sample_interventional(T, intervention, burn_in=50, generator=None, return_regimes=False)[source]
Sample interventional data with regime switching.
- Parameters:
return_regimes (bool) – If True, return (X, regimes) tuple. Otherwise just X.
T (int)
intervention (InterventionSpec)
burn_in (int)
generator (Generator | None)
- Return type:
- Returns:
torch.Tensor or Tuple[torch.Tensor, np.ndarray] – Time series (T, N), or (time series, regimes) if return_regimes=True.