This library contains some useful scikit-learn compatible classes for feature selection.
Project description
felimination
This library contains some useful scikit-learn compatible classes for feature selection.
Features
Requirements
- Python 3.7+
- NumPy
- Scikit-learn
- Pandas
Installation
In a terminal shell run the following command
pip install felimination
Usage
from felimination.rfe import PermutationImportanceRFECV
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification
import numpy as np
X, y = make_classification(
n_samples=1000,
n_features=20,
n_informative=6,
n_redundant=10,
n_clusters_per_class=1,
random_state=42,
)
selector = PermutationImportanceRFECV(LogisticRegression(), step=0.3)
selector.fit(X, y)
selector.support_
# array([False, False, False, False, False, False, False, False, False,
# False, False, True, False, False, False, False, False, False,
# False, False])
selector.ranking_
# array([9, 3, 8, 9, 7, 8, 5, 6, 9, 6, 8, 1, 9, 7, 8, 9, 9, 2, 4, 7])
selector.plot()
It looks like 5
is a good number of features, we can set the number of features to select to 5 without need of retraining
selector.set_n_features_to_select(5)
selector.support_
# array([False, True, False, False, False, False, True, False, False,
# False, False, True, False, False, False, False, False, True,
# True, False])
License
This project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details
Acknowledgments
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
felimination-0.2.1.tar.gz
(14.0 kB
view hashes)
Built Distribution
Close
Hashes for felimination-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 199202929ed82c2dd0fc9fcb0aa2bd999e45b11da9141ff21a0b28df3609532c |
|
MD5 | 7a3fa4a5ddcb3f70f93b5c87156c29a7 |
|
BLAKE2b-256 | 72c2a03a4e1ae85d7b6345b263b7240524079b9d8fe601e96c613ca20abe736d |