dotime.DoTime
- class dotime.DoTime(config=None, seed=42, chain_prob=0.15, regime_switching_prob=0.15)[source]
Bases:
objectPrior distribution over temporal SCMs with interventions.
Main interface for generating synthetic causal time series data.
- Parameters:
- __init__(config=None, seed=42, chain_prob=0.15, regime_switching_prob=0.15)[source]
- Parameters:
config (Dict[str, Any], optional) – Configuration dictionary. If None, uses DEFAULT_CONFIG.
seed (int) – Random seed for reproducibility.
chain_prob (float) – Probability of generating a chain SCM (default 0.15).
regime_switching_prob (float) – Probability of generating a regime-switching SCM (default 0.15).
Methods
__init__([config, seed, chain_prob, ...])generate_dataset(n_scms[, T])Generate a dataset of paired observational/interventional time series.
generate_pair([T])Generate a pair of observational and interventional time series.
generate_regime_pair([T, num_regimes])Generate a paired (obs, int) trajectory from a regime-switching SCM.
generate_training_tuples(n_scms[, T])Generate training tuples for PFN training.
Sample a temporal SCM from the prior.
- sample_scm()[source]
Sample a temporal SCM from the prior.
Distribution: - chain_prob: chain SCMs - regime_switching_prob: regime-switching SCMs - remaining: diverse nonlinear SCMs
- Return type:
- Returns:
TemporalSCM – Sampled temporal SCM (or compatible regime-switching SCM).
- generate_pair(T=None)[source]
Generate a pair of observational and interventional time series.
- Parameters:
T (int, optional) – Length of time series. If None, uses config default.
- Return type:
- Returns:
Tuple[torch.Tensor, torch.Tensor, InterventionSpec, TemporalSCM] – (X_obs, X_int, intervention_spec, scm)
- generate_regime_pair(T=None, num_regimes=2)[source]
Generate a paired (obs, int) trajectory from a regime-switching SCM.
Like
generate_pair()but forces a regime-switching SCM with a fixed number of regimes (for the regime-density benchmark tiers).- Return type:
tuple[Tensor,Tensor,InterventionSpec,RegimeSwitchingTemporalSCM]- Parameters:
- generate_dataset(n_scms, T=None)[source]
Generate a dataset of paired observational/interventional time series.
- Parameters:
- Return type:
- Returns:
List[Tuple[torch.Tensor, torch.Tensor, InterventionSpec]] – List of (X_obs, X_int, intervention_spec) tuples.