Selecting features using SHAP values
Project description
SHAP-Selection: Selecting feature using SHAP values
Due to the increasing concerns about machine learning interpretability, we believe that interpretation could be added to pre-processing steps. Using this library, you will be able to select the most important features from a multidimensional dataset while being able to explain your decisions!
To use SHAP-Selection, you will need:
Instalation
pip install shap-selection
Citation
@INPROCEEDINGS{MarcilioJr2020shapselection,
author={W. E. {MarcÃlio} and D. M. {Eler}},
booktitle={2020 33rd SIBGRAPI Conference on Graphics, Patterns and Images (SIBGRAPI)},
title={From explanations to feature selection: assessing SHAP values as feature selection mechanism},
year={2020},
pages={340-347},
doi={10.1109/SIBGRAPI51738.2020.00053}
}
Usage
To use SHAP-Selection, you must have a trained model. It works both for classification and regression purposes!
Load a dataset
iris_data = load_iris()
X, y = iris_data.data, iris_data.target
feature_names = np.array(iris_data.feature_names)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
Fit a model
model = cb.CatBoostClassifier(verbose=False)
model.fit(X_train, y_train)
Use SHAP-Selection
from shap_selection import feature_selection
# please, use agnostic = True to use with any model...
# agnostic = True will only work with tree-based models
feature_order = feature_selection.shap_select(model, X_train, X_test, feature_names, agnostic=False)
Support
Please, if you have any questions feel free to contact me at wilson_jr@outlook.com
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file shap_selection-0.1.5.tar.gz
.
File metadata
- Download URL: shap_selection-0.1.5.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2b725bf291b2f6d49ffd9f203a8d0866b74edd34ba07309d7ff96fccb6feb12 |
|
MD5 | e62ce019a81b798306d988d5465cd148 |
|
BLAKE2b-256 | c18a6c80089af627ee30cdc7c4b252f69b737e5d98385ab22177e6b8c19794bb |
Provenance
File details
Details for the file shap_selection-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: shap_selection-0.1.5-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be83fcc673464fb3a7f59afec246248a4892f6daec188796c863dc9a67742158 |
|
MD5 | dad2de7478854c5751cc07b127673b4f |
|
BLAKE2b-256 | 0618ce908c5baadb090b4cb3a252a2321d4381f93b423dae5fae36d74462458b |