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 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,optimization='sparsity')
# explain an instance
NICE_explainer.explain(x)
Examples
References
NICE: An Algorithm for Nearest Instance Counterfactual Explanations
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file NICEx-0.2.2.tar.gz.
File metadata
- Download URL: NICEx-0.2.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9320a5a5f277914e425bed1bc73e9b50f0472c75b6a4f3d43cd723ac1821031d
|
|
| MD5 |
953e3cf53d1c42e52c3caf35ddd7ad9b
|
|
| BLAKE2b-256 |
e24ef7e3e61f459c20d35573c6248fb148db9650e8472e3718418ad45e7ca744
|
File details
Details for the file NICEx-0.2.2-py3-none-any.whl.
File metadata
- Download URL: NICEx-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fcbc7ce580fb5c8735937fae35e10ac7b7a306816abe010820a41574a1b0033
|
|
| MD5 |
7b2398c77bfd09a8fd4be880510f9ea5
|
|
| BLAKE2b-256 |
b294c71ea84248e4b68f9d3e68c6469d37d90f5bb209f33b8c275fcf93ad1695
|