mini_causal.partial_counter.PartialCounterfactualRegression¶
- class mini_causal.partial_counter.PartialCounterfactualRegression(model, X, y)¶
PartialCounterfactualRegression is class that uses partial modeling or methods to measure the impact of features on the built-in regression models.
It inherits all the methods and properties from the CausalFeatureImportance.
- 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
- Attributes
- partial_fit :
fits the partial estimator i.e the model without the feature
- individual_causal_effects (np.ndarray):
returns an array of the individual causal effects
- average_causal_effects (np.ndarray):
returns the average causal effect float value
ML and AI https://causalml-book.org/
- __init__(model, X, y)¶
Methods
__init__(model, X, y)average_causal_effect(X, feature)The average causal effect
individual_causal_effects(X, feature)The individual causal effects of the predicted
partial_model(feature)Clone the parameters from the fitted model Then build a partial model from the scratch