cleverly.TMLEMethod#
- class cleverly.TMLEMethod(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 = 'tmle')[source]#
Normalized configuration for the built-in analytic TMLE method.
IdentifiedEffect.estimate(method="tmle", ...)normalizes keyword shortcuts into this object before fitting. Passing one directly gives the same computational path.- Parameters:
See also
CollaborativeTMLEMethodSelects the treatment mechanism against the targeted loss.
DRTMLEMethodCorrects both nuisances with reduced-dimension regressions.
ModelSpecThe learners this configuration fits with.
cleverly.IdentifiedEffectWhat this configuration is passed to.
Examples
>>> from cleverly import CrossFitting, TMLEMethod >>> method = TMLEMethod(cross_fitting=CrossFitting(n_folds=5), name="tmle") >>> method.cross_fitting.n_folds 5
The flat shortcuts route to the same fields, so the two spellings agree:
>>> TMLEMethod().with_overrides(n_folds=5) == method True
Methods#
- TMLEMethod.estimator_kwargs(*, longitudinal: bool = False) dict[str, Any][source]#
Translate normalized groups into the selected engine API.
- TMLEMethod.with_overrides(**overrides: Any) TMLEMethod[source]#
Return a copy with flat shortcuts normalized by concern.
- Parameters:
- **overrides
Any Fields listed in the public shortcut table, such as
n_foldsoralpha.
- **overrides
- Returns:
TMLEMethodNew immutable configuration.
- Raises:
MethodConfigurationErrorIf an option is not supported by the method.
Notes
alpha=setsInference.alpha, the reported interval’s significance level. Usesubmodel_alpha=forTargeting.submodel_alpha, the separate logistic-submodel bound.
Attributes#
- TMLEMethod.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)#
- TMLEMethod.inference: Inference = Inference(alpha=0.05, n_bootstrap=0, bootstrap_resampling='auto', simultaneous=True, n_multiplier='auto', multiplier_kind='rademacher')#
- TMLEMethod.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')#
- TMLEMethod.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)#