wildboar.explain.counterfactual.base#
Module Contents#
Classes#
Base estimator for counterfactual explanations |
- class wildboar.explain.counterfactual.base.BaseCounterfactual#
Bases:
sklearn.base.BaseEstimatorBase estimator for counterfactual explanations
- abstract fit(estimator)#
Fit the counterfactual to a given estimator
- Parameters:
estimator (object) – An estimator for which counterfactual explanations are produced
- Return type:
self
- abstract transform(x, y)#
Transform the i:th sample in x to a sample that would be labeled as the i:th label in y
- Parameters:
x (array-like of shape (n_samples, n_timestep) or (n_samples, n_dimension, n_timestep)) – The samples to generate counterfactual explanations for
y (array-like of shape (n_samples,)) – The desired label of the counterfactual sample
- Returns:
counterfactuals (ndarray of same shape as x) – The counterfactual for each sample. If success[i] == False, then the value of counterfactuals[i] is undefined.
success (ndarray of shape (n_samples,)) – Boolean vector indicating successful transformations.