ICausalModel<T>

Interfaces · AiDotNet.Interfaces

Interface for causal inference models (meta-learners).

Implements: IFeatureAware, IFullModel<T, Matrix<T>, Vector<T>>, IGradientComputable<T, Matrix<T>, Vector<T>>

Known implementations: CausalModelBase<T>

For Beginners

Causal inference models estimate the causal effect of a treatment on an outcome. Unlike prediction, we want to know “what would happen if we applied treatment X?” This is called the treatment effect.

How It Works

Key concepts:

  • Treatment: The intervention we’re studying (e.g., a drug, a marketing campaign)
  • Outcome: The result we measure (e.g., health, sales)
  • CATE: Conditional Average Treatment Effect - effect for specific subgroups
  • ATE: Average Treatment Effect - overall average effect

Meta-learners:

  • S-Learner: Single model with treatment as feature
  • T-Learner: Two separate models for treatment/control
  • X-Learner: Cross-fitting approach for heterogeneous effects

Methods

Method Summary
T EstimateAverageTreatmentEffect(Matrix<T> features) Estimates the Average Treatment Effect (ATE) across the population.
Vector<T> EstimateTreatmentEffect(Matrix<T> features) Estimates the Conditional Average Treatment Effect (CATE) for subjects.
Vector<T> PredictControl(Matrix<T> features) Predicts the outcome under control.
Vector<T> PredictTreated(Matrix<T> features) Predicts the outcome under treatment.
void Fit(Matrix<T> features, Vector<T> treatment, Vector<T> outcome) Fits the causal model to observational data.