Skip to main content

dml_partial_linear_reference

Function dml_partial_linear_reference 

Source
pub fn dml_partial_linear_reference(
    y: &[f64],
    d: &[f64],
    x: &[Column<'_>],
    n_folds: usize,
) -> DmlPartialLinearReference
Expand description

Fit a partially-linear DML model Y = θ·D + g(X) + ε, D = m(X) + ν with a mature Python DML library and return its orthogonal estimate of θ.

y, d, and the columns of x must share a common length. n_folds sets the cross-fitting fold count (DML’s sample-splitting ingredient). The reference uses gradient-boosted nuisance learners so the partialling-out is genuinely nonparametric, exercising the orthogonality the estimator claims.

When neither DoubleML nor EconML is importable, the returned struct has available == false; the interpreter itself still exits zero (the import probe is guarded), so this is not a hard failure — the caller decides whether to skip. A missing python3/numpy/scikit-learn, by contrast, is still a loud failure via the underlying run_python contract.