Skip to main content

SHAPwise Feature Selection (SFS)

Overview

SHAPwise Feature Selection (SFS) is a Python library designed to enhance predictive model performance by leveraging SHapley Additive exPlanations (SHAP) values for feature selection. This innovative method systematically evaluates the impact of features on model predictions, identifying and excluding less impactful ones to refine the feature set. The result is not only an improvement in model accuracy but also in interpretability and efficiency.

Features

  • SHAP Value Analysis: Utilizes SHAP values to quantify the contribution of each feature towards the model's predictions.
  • Iterative Feature Selection: Employs an iterative process to remove features with low correlation between their SHAP values and their impact on the model outcome.
  • Model Performance Enhancement: Aims to improve model performance by retaining only the most impactful features.
  • Compatibility: Designed for use with PyTorch and FastAI, facilitating easy integration into existing machine learning workflows.
  • Interpretability Improvement: Enhances model interpretability by focusing on features that significantly affect model predictions.

Installation

pip install sfs-shapwise-feature-selection

Usage

Basic Example

from sfs import SHAPwiseFeatureSelector
from sklearn.metrics import accuracy_score
from your_model import YourModel
import pandas as pd

# Load your dataset
X, y = pd.read_csv("your_dataset.csv").drop("target", axis=1), pd.read_csv("your_dataset.csv")["target"]

# Initialize your model
model = YourModel()
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize SHAPwise Feature Selector
sfs_model = SHAPwiseFeatureSelector(model, accuracy_score)

# Train your model using the SHAPwise Feature Selection method
sfs_model.fit(X_train, y_train, X_test, y_test)

drop_features = sfs_model.sfs_model
model = sfs_model.base_estimator

Advanced Configuration

Refer to the documentation for advanced configuration options, including setting thresholds for SHAP value correlation and customizing the iterative selection process.

Documentation

For detailed documentation, including API references and advanced usage examples, please visit SFS Documentation.

Contributing

We welcome contributions to the SFS project! Please refer to our contribution guidelines for more information on how to report issues, submit pull requests, and more.

License

SFS is released under the MIT License. See the LICENSE file for more details.

Acknowledgments

This project was inspired by the work on SHapley Additive exPlanations (SHAP) and aims to bring the power of SHAP values to the realm of feature selection for machine learning models.

Citation

If you use SFS in your research, please cite our paper:

@article{yourname2024shapwise,
  title={SHAPwise Feature Selection (SFS): Enhancing Predictive Models through Correlation-Based Feature Analysis},
  author={Your Name and Collaborators},
  journal={Journal of Machine Learning Research},
  volume={xx},
  number={xx},
  pages={xx-xx},
  year={2024}
}

For further information and support, please open an issue in the GitHub repository.

Release files for sfs-shapwise-feature-selection 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sfs-shapwise-feature-selection 0.1.0
File Size Uploaded
sfs-shapwise-feature-selection-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sfs-shapwise-feature-selection 0.1.0
File Interpreter ABI Platform
sfs_shapwise_feature_selection-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / sfs-shapwise-feature-selection-0.1.0.tar.gz

Download URL sfs-shapwise-feature-selection-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fdbd83a07f3e64f32ddb66decc25d6c15518df7b5540ac78d66d3ab1fa341b88
BLAKE2b-256 checksum
How to use checksums
4abeebd19eda7d92890569d0af1c930f4bca621fbb2d79aacb5d549c99fa9701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.13

Release files / sfs_shapwise_feature_selection-0.1.0-py3-none-any.whl

Download URL sfs_shapwise_feature_selection-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
feaa1a9aafb2ffd016c78395494cb6c149bb1cf93097b97d1ce655143ceab61f
BLAKE2b-256 checksum
How to use checksums
68535b623d3a88152dc1d6bb3eb60fc0dace09bf7396791df60b37af03ee5381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page