causallib.utils.crossfit module
- causallib.utils.crossfit.cross_fitting(estimator, X, y, n_splits=5, predict_proba=False, return_estimator=True)[source]
- Parameters
estimator (object) – sklearn object
X (pd.DataFrame) – Covariate matrix of size (num_subjects, num_features).
y (pd.Series) – Observed outcome of size (num_subjects,).
n_splits (int) – number of folds
predict_proba (bool) –
- If True, the treatment model is a classifier
and use ‘predict_proba’,
If False, use ‘predict’.
return_estimator (bool) – If true return fitted estimators of each fold
- Returns
array of held-out prediction, if return estimator:
a tuple of estimators on held-out-data