Skip to main content

antecedent_model/
lib.rs

1//! Probabilistic and structural causal models.
2//!
3//! Compiles DAGs to topological execution plans; sampling uses intervention
4//! overlays rather than cloning models.
5//!
6//! SPDX-License-Identifier: MIT OR Apache-2.0
7
8#![forbid(unsafe_code)]
9#![deny(missing_docs)]
10
11pub mod batch;
12pub mod compile;
13pub mod do_sampler;
14pub mod error;
15pub mod evaluate;
16pub mod lgssm;
17pub mod mechanism;
18pub mod model_collection;
19pub mod overlay;
20pub mod registry;
21pub mod sample;
22
23pub use batch::{
24    MechanismWorkspace, NoiseBatch, NoiseBatchMut, ParentBatch, ValueBatch, ValueBatchMut,
25};
26pub use compile::{
27    CompiledCausalModel, CompiledMechanismStore, DynamicMechanism, InvertibleStructuralCausalModel,
28    MechanismSlot, ModelOutputLayout, ParentGatherPlan, ProbabilisticCausalModel,
29    StructuralCausalModel,
30};
31pub use do_sampler::{
32    DoSampleResult, KdeDoSampler, McmcDoSampler, WeightingDoSampler, interventional_mean,
33};
34pub use error::ModelError;
35pub use evaluate::{MechanismPredictiveCheck, ModelEvaluationReport, ModelEvaluator};
36pub use lgssm::{
37    infer_lgssm_innovations, kalman_filter, pack_innovations, rts_smooth, sample_lgssm_noise,
38    unpack_innovations,
39};
40pub use mechanism::{
41    NoiseInferenceMode, evaluate_batch_topo, evaluate_column, infer_noise_column,
42    infer_noise_column_rng, log_prob_column, sample_column, sample_noise_batch,
43    sample_noise_column,
44};
45pub use model_collection::ModelCollection;
46pub use overlay::{InterventionOverlay, ModelView};
47pub use registry::{
48    MechanismAssignment, MechanismCandidate, MechanismFamily, MechanismRegistry, SelectionPolicy,
49};
50pub use sample::{
51    refuse_cross_family_soft, sample_conditional_interventional, sample_interventional,
52    sample_observational, sample_observational_into, sample_posterior_predictive,
53    sample_stochastic, sample_structural_with_overlay, sample_with_overlay,
54    sample_with_overlay_into, soft_to_slot,
55};
56
57/// Crate version.
58pub const VERSION: &str = env!("CARGO_PKG_VERSION");