cleverly.AdaptiveIPTWMethod#
- class cleverly.AdaptiveIPTWMethod(models: ModelSpec = ModelSpec(outcome_learner=None, treatment_learner=None, missingness_learner=None, intermediate_learner=None, pseudo_learner=None, censoring_learner=None, competing_learner=None, density_bins=None, ratio='density', screen_treatment=False, screen_threshold=0.1, min_retain=None, hazard_pooling='node', outcome_by_arm=False, survival_model=None), 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', conditional_form='arm_mean', isotonic=False, ratio_trim=None, node_bounds=None), inference: Inference = Inference(alpha=0.05, n_bootstrap=0, bootstrap_resampling='auto', simultaneous=None, n_multiplier=10000, multiplier_kind='mammen', band_scale='logit', band_reference='normal'), runtime: Runtime = Runtime(random_state=None, run_id=None, n_jobs=1), name: str = 'adaptive_iptw', form: str = 'targeted', reduced_outcome_learner: Any = None)[source]#
Configure the adaptive-propensity IPTW estimator.
The estimator reports the Horvitz-Thompson mean of each arm with a propensity that is targeted along the reduced regression of the outcome on the fitted propensity (van der Laan 2012, WP302, Theorem 1). It fits no outcome regression, so the fluctuation settings of
Targetingand theratioanddensity_binssettings ofModelSpecstay at their defaults. An interval needs a known treatment mechanism. Otherwise the fit reports point estimates under the statusestimated_mechanism_plugin.- Parameters:
- models
ModelSpec Nuisance learners and related model settings.
- cross_fitting
CrossFitting Sample-splitting settings.
- targeting
Targeting Mechanism-tilt and solver settings.
- inference
Inference Interval and resampling settings.
- runtime
Runtime Seed, run identifier, and parallelism.
- name
str Stable method name.
- form{“targeted”, “one_step”}, default=”targeted”
The reported form.
"targeted"is the Horvitz-Thompson mean at the tilted propensity."one_step"is the estimating-equation correction at the initial nuisances. A fit computes both and records the other.- reduced_outcome_learner
estimatororNone, default=None Learner for the reduced regression of the outcome on the fitted propensity.
Nonetakesmodels.outcome_learner, and then the default Super Learner.
- models
See also
TMLEMethodFits an outcome regression and a fluctuation of it.
DRTMLEMethodCorrects both nuisances with reduced-dimension regressions.
ModelSpecOwns the treatment learner the propensity is fitted with.
Examples
>>> from cleverly import ATE, AdaptiveIPTWMethod, CausalStudy, ModelSpec, PointTreatment >>> from cleverly.datasets import make_nonlinear_ate >>> from sklearn.linear_model import LinearRegression, LogisticRegression >>> frame, _ = make_nonlinear_ate(n=200, seed=0) >>> study = CausalStudy( ... frame, ... design=PointTreatment( ... outcome="Y", treatment="A", adjustment=["W1", "W2", "W3", "W4"] ... ), ... ) >>> models = ModelSpec( ... outcome_learner=LinearRegression(), ... treatment_learner=LogisticRegression(max_iter=1000), ... ) >>> result = study.identify(ATE()).estimate( ... method=AdaptiveIPTWMethod(models=models), cross_fit=False, random_state=0 ... ) >>> sorted(result.estimates), result.inference_status (['ate'], 'estimated_mechanism_plugin')
Methods#
- AdaptiveIPTWMethod.estimator_kwargs(*, longitudinal: bool = False) dict[str, Any][source]#
Translate this configuration for the point-treatment adaptive IPTW engine.
- Parameters:
- longitudinalbool
Must be false because adaptive IPTW has no longitudinal derivation.
- Returns:
- Raises:
MethodConfigurationErrorWhen
longitudinalis true.