dml-core
Double / debiased machine learning for causal inference in Rust.
dml-core implements the double / debiased machine learning framework of
Chernozhukov et al. (2018): Neyman-orthogonal scores,
flexible nuisance learners and cross-fitting, with valid standard errors, confidence intervals
and tests. Every model is tested for numerical agreement with the reference
DoubleML package. It is the core of the
dml-rs Python package.
Example
use ;
let data = new?;
let learner = new.n_estimators.learning_rate;
let fit = new // learners for E[Y|X] and E[D|X]
.n_folds
.n_rep // repeated sample splitting, aggregated by the median
.seed
.fit?;
println!;
let ci = fit.confint?;
Features
- Models: partially linear regression (
Plr), interactive regression (Irm, ATE / ATTE), partially linear IV (Pliv), interactive IV (Iivm, LATE), difference-in-differences for panels and repeated cross-sections (Did,DidCs) and staggered adoption (StaggeredDid, with group, time and event-study aggregation) - Heterogeneous effects: S-, T-, X-, R- and DR-learners; best linear predictor of the CATE and
group average treatment effects (
Blp) - Inference: multiple treatments, repeated sample splitting, multiplier bootstrap with
simultaneous confidence bands, Romano–Wolf / Holm / Bonferroni adjustment, cluster-robust
standard errors for one- and two-way clustered data (
DmlData::with_clusters,with_two_way_clusters) - Learner diagnostics: out-of-sample RMSE / log loss of every nuisance learner
(
DmlFit::nuisance_loss) and its targets for custom metrics (DmlFit::nuisance_targets) - Sensitivity analysis: bounds for omitted confounders, robustness values and benchmarks
(
DmlFit::sensitivity_analysis,sensitivity_benchmark) - Learners:
GradientBoostingRegressor/GradientBoostingClassifier,RandomForestRegressor/RandomForestClassifier,Ols(ridge),Lasso,LassoCV,LogisticRegression,LogisticRegressionCV(penalties chosen by cross-validation as in scikit-learn), or your own through theRegressor/Classifiertraits - Extensible: implement
LinearScoreModelto add a new orthogonal score and reuse the whole cross-fitting and inference engine - Fast and lightweight: pure Rust without BLAS; folds and trees are fitted in parallel with
rayon (
parallelfeature, on by default); minimum supported Rust version 1.80
See the repository for benchmarks, validation details and Python usage.
License
Licensed under either of Apache License 2.0 or MIT license, at your option.