cleverly.DRTMLEMethod#

class cleverly.DRTMLEMethod(models: ModelSpec = ModelSpec(outcome_learner=None, treatment_learner=None, missingness_learner=None, intermediate_learner=None, pseudo_learner=None, censoring_learner=None, density_bins=None, ratio='density', screen_treatment=False, screen_threshold=0.1, min_retain=None, outcome_by_arm=False, survival_model='iterated_mean'), cross_fitting: CrossFitting = CrossFitting(enabled=True, n_folds=10, learner_folds=5, repeats=1, stratify_by='none', targeting_scheme='pooled', fold_evaluation=False, split_plan=None), targeting: Targeting = Targeting(fluctuation='logistic', algorithm='iterative', g_bounds='auto', q_bounds=None, nuisance_bound=0.01, submodel_alpha=0.9995, target_weights=False, step_size=0.001, max_iter=20, tol=1e-10, stopping='relative', step_bound=None, step_search=True, iterate='last', isotonic=False), inference: Inference = Inference(alpha=0.05, n_bootstrap=0, bootstrap_resampling='auto', simultaneous=True, n_multiplier='auto', multiplier_kind='rademacher'), runtime: Runtime = Runtime(random_state=None, run_id=None, n_jobs=1), name: str = 'drtmle', guard: tuple[str, ...] = ('Q', 'g'), reduction: str = 'univariate', reduced_outcome_learner: Any = None, reduced_treatment_learner: Any = None, reduced_crossfit: str = 'pooled', update_order: str = 'drtmle', evaluation: Any = None, randomized: bool = False)[source]#

Configure the reduced-dimension DR-TMLE correction.

Parameters:
modelsModelSpec

Nuisance learners and related model settings.

cross_fittingCrossFitting

Sample-splitting settings.

targetingTargeting

Fluctuation and solver settings.

inferenceInference

Interval and resampling settings.

runtimeRuntime

Seed, run identifier, and parallelism.

namestr

Stable method name.

guardtuple of {“Q”, “g”}, default=(“Q”, “g”)

The extra score equations to solve, named by the nuisance whose misspecification each one corrects: "Q" adds equation (9) and "g" adds equation (10).

reduction{“univariate”, “bivariate”}, default=”univariate”

Reduced-regression family.

reduced_outcome_learnerestimator or None, default=None

Learner for the reduced outcome regression.

reduced_treatment_learnerestimator or None, default=None

Learner for the reduced treatment regression.

reduced_crossfit{“pooled”, “nested”}, default=”pooled”

Cross-fitting policy for reduced regressions.

update_order{“drtmle”, “benkeser”}, default=”drtmle”

Order of reduced targeting updates.

evaluationdataframe or None, default=None

Optional evaluation data for a companion fit.

randomizedbool, default=False

Whether treatment was randomized, for a fit with missing outcomes. False fits an observational missing outcome with the composite indicator. Known treatment probabilities belong to the design: PointTreatment(treatment_probabilities=...).

See also

TMLEMethod

The base configuration, without the reduced-dimension correction.

CollaborativeTMLEMethod

A treatment mechanism selected for the targeted estimate.

ModelSpec

Owns the first-stage learners the reduced regressions correct.

Examples

>>> from cleverly import DRTMLEMethod
>>> method = DRTMLEMethod(guard=("Q", "g"))
>>> method.name, method.guard
('drtmle', ('Q', 'g'))

A randomized trial knows its own treatment mechanism, so only the outcome regression needs guarding:

>>> DRTMLEMethod(guard=("Q",), randomized=True).guard
('Q',)

Methods#

DRTMLEMethod.estimator_kwargs(*, longitudinal: bool = False) → dict[str, Any][source]#

Translate this configuration for the point-treatment DR-TMLE engine.

Parameters:
longitudinalbool

Must be false because no longitudinal correction is supported.

Returns:
dict of str to Any

DR-TMLE engine keyword arguments.

Attributes#

DRTMLEMethod.evaluation: Any = None#
DRTMLEMethod.guard: tuple[str, ...] = ('Q', 'g')#
DRTMLEMethod.name: str = 'drtmle'#
DRTMLEMethod.randomized: bool = False#
DRTMLEMethod.reduced_crossfit: str = 'pooled'#
DRTMLEMethod.reduced_outcome_learner: Any = None#
DRTMLEMethod.reduced_treatment_learner: Any = None#
DRTMLEMethod.reduction: str = 'univariate'#
DRTMLEMethod.update_order: str = 'drtmle'#