Nearest Instance Counterfactual explanations
Project description
Nearest Instance Counterfactual Explanations (NICE)
NICE is an algorithm to generate Counterfactual Explanations for heterogeneous tabular data. Our approach exploits information from a nearest instance to speed up the search process and guarantee that an explanation will be found.
Installation
Install NICE through Pypi
pip install NICEx
or github
pip install git git+https://github.com/ADMantwerp/nice.git
Usage
NICE requires acces to the prediction score and trainingdata to generate counterfactual explanations.
from nice.explainers import NICE
# Initialize NICE by specifing the optimization strategy
NICE_explainer = NICE(optimization='sparsity')
# Fit our NICE explainer on the training data and classifier
NICE_explainer.fit(predict_fn,X_train,cat_feat,num_feat,y_train)
# explain an instance
NICE_explainer.explain(x)
Examples
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
NICEx-0.1.0.tar.gz
(9.5 kB
view hashes)
Built Distribution
NICEx-0.1.0-py3-none-any.whl
(10.4 kB
view hashes)