Skip to main content

A Python package for feature selection using SHAP values.

Project description

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.

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

sfs-shapwise-feature-selection-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sfs-shapwise-feature-selection-0.1.0.tar.gz.

File metadata

File hashes

Hashes for sfs-shapwise-feature-selection-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdbd83a07f3e64f32ddb66decc25d6c15518df7b5540ac78d66d3ab1fa341b88
MD5 2ec306b5b73628516704748d0e2b5c3f
BLAKE2b-256 4abeebd19eda7d92890569d0af1c930f4bca621fbb2d79aacb5d549c99fa9701

See more details on using hashes here.

File details

Details for the file sfs_shapwise_feature_selection-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sfs_shapwise_feature_selection-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 feaa1a9aafb2ffd016c78395494cb6c149bb1cf93097b97d1ce655143ceab61f
MD5 cb2ffd01f58354394399a61433df3828
BLAKE2b-256 68535b623d3a88152dc1d6bb3eb60fc0dace09bf7396791df60b37af03ee5381

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page