cleverly.IPSIMethod#

class cleverly.IPSIMethod(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 = 'ipsi')[source]#

Configure Kennedy’s estimator of incremental propensity-score interventions.

The estimator of Kennedy (2019, Algorithm 1), with the dropout weights of Kim, Kennedy and Naimi (2021), fitted by cleverly.longitudinal.IPSI. It averages the influence function at the fitted nuisances and fits no fluctuation, so the fluctuation settings of Targeting stay at their defaults. g_bounds bounds the cumulative censoring factor. The tilt factor is never bounded. A point-treatment functional refuses the method.

Parameters:
modelsModelSpec

Nuisance learners. pseudo_learner fits a real-valued target, and its default is a regression Super Learner with no clip.

cross_fittingCrossFitting

Sample-splitting settings. Above one fold, each fold fits every nuisance on its training rows.

targetingTargeting

g_bounds and q_bounds. submodel_alpha, max_iter, tol, stopping, step_bound, step_search and iterate are refused, because the estimator fits no fluctuation.

inferenceInference

Interval and resampling settings. The bootstrap runs and reports a bootstrap sd, with no percentile inference.

runtimeRuntime

Seed, run identifier, and parallelism.

namestr

Stable method name.

See also

SDRMethod

The sequential regression of static, dynamic and known-policy plans.

cleverly.longitudinal.IPSI

The engine this configuration is translated for.

cleverly.IncrementalEffect

The functional that takes this method.

Examples

>>> from cleverly import CrossFitting, IPSIMethod
>>> method = IPSIMethod(cross_fitting=CrossFitting(n_folds=5))
>>> method.name, method.cross_fitting.n_folds
('ipsi', 5)
>>> "alpha" in method.estimator_kwargs(longitudinal=True)
False

Methods#

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

Translate this configuration for the longitudinal IPSI engine.

Parameters:
longitudinalbool

Must be true, because the estimator fits a longitudinal panel.

Returns:
dict of str to Any

IPSI engine keyword arguments.

Raises:
MethodConfigurationError

When longitudinal is false, or when a fluctuation setting differs from its default.

Attributes#

IPSIMethod.name: str = 'ipsi'#