mini_causal.partial_counter.PartialCounterfactualClassifier

class mini_causal.partial_counter.PartialCounterfactualClassifier(model, X, y)

PartialCounterfactualClassifier is class that uses partial modeling or methods to measure the impact of features on the built-in classification models.

It inherits all the methods and properties from the PartialCounterfactual.

Parameters:
  • model – the trained model

  • X (pd.DataFrame) – The features stored in a dataframe format dataframe are used to simplify accessing the features for partial modeling and calculating causal metrics

  • {pd.DataFrame (y) – The target values must have the same length as the X arg

  • np.array} – The target values must have the same length as the X arg

partial_fit

fits the partial estimator i.e the model without the feature

individual_causal_effects

returns an array of the individual causal effects

Type:

np.ndarray

average_causal_effects

returns the average causal effect float value

Type:

np.ndarray

References

__init__(model, X, y)

Methods

__init__(model, X, y)

average_causal_effect(X, feature)

The average causal effect

average_causal_effect_probs(X, feature)

The average causal effect on the predicted probabilities

individual_causal_effects(X, feature)

The individual causal effects of the predicted

individual_causal_effects_probs(X, feature)

The individual causal effects of the predicted probabilities

partial_model(feature)

Clone the parameters from the fitted model Then build a partial model from the scratch