causallib.evaluation.evaluate#

evaluate(estimator, X, a, y, cv=None, metrics_to_evaluate='defaults', plots=False)[source]#

Evaluate model in cross-validation of the provided data

Parameters:
  • | (estimator (causallib.estimation.base_estimator.IndividualOutcomeEstimator) – causallib.estimation.base_weight.WeightEstimator | causallib.estimation.base_weight.PropensityEstimator) : an estimator. If using cv, it will be refit, otherwise it should already be fit.

  • X (pandas.DataFrame) – Covariates.

  • a (pandas.Series) – Treatment assignment.

  • y (pandas.Series) – Outcome.

  • cv (list[tuples] | generator[tuples] | None) – list the number of folds containing tuples of indices (train_idx, validation_idx) in an iloc manner (row number). If None, there will be no cross-validation. If cv=”auto”, a stratified Kfold with 5 folds will be created and used for cross-validation.

  • metrics_to_evaluate (dict | "defaults" | None) – key: metric’s name, value: callable that receives true labels, prediction, and sample_weights (the latter may be ignored). If “defaults”, default metrics are selected. If None, no metrics are evaluated.

  • plots (bool) – whether to generate plots

Returns:

EvaluationResults