This package provides code for optimal feature selection using forward and backward wrapper-based methods. It also generates an Excel report that captures each step and result of the feature selection process, offering clear insights and explanations of the selected features.
Project description
Feature Selection
This repository contains code to perform wrapper-based feature selection (i.e. forward and backward).
Install requirements:
pip install ml-feature-selector
How to use?
Load model selection class from the package
from ml_featselect.feature_selector import ModelFeatureSelection
ModelFeatureSelection(model=model,
scorer=r2_score,
X_train=X_train,
y_train=y_train,
higher_good=False,
)
model: sklearn BaseEstimator(Machine Learning Models)(Eg: KNeighborsRegressor())
scorer: Scorer like r2 square, % error or Custom Scorer
X_train: np.ndarray (Training input data (X,d),
y_train: np.ndarray (Target Labels)
higher_good: Boolean (True when the performance is better for higher values and False when the performance is better for lower value)
Find the best features using the forward or backward feature selection method using feature_selection_type=('forward' or 'backward')
best_features = model_selection.find_best_features(feature_selection_type='forward')
Save each step of the feature selection method in an Excel file.
model_selection.feature_selection_tabularize(best_features, './feature_selected.xlsx')
Find the example at main.py
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 ml_feature_selector-0.1.3.tar.gz
.
File metadata
- Download URL: ml_feature_selector-0.1.3.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c36aacb1651e0281c027c0239af2b47e31f7d7e485f6982b4c02182f9b20256 |
|
MD5 | 2cdadc0b384c3002fd2ae69aee9018f5 |
|
BLAKE2b-256 | 088ab4e17973709b28c1f8434b2fa82937b97e811df3ba4ed3d7b472bd9750ab |
File details
Details for the file ml_feature_selector-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: ml_feature_selector-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b9741ba1bdac90bd1dd71cd25bcb61c8727eecf4bc13cbda10f4fb6f22b55f1 |
|
MD5 | f8e8e8dc27e11e13b59b31024d017e62 |
|
BLAKE2b-256 | 577165377a35e324f2a5a0ece58b2232fad028a38838676bb6635dc2a03ad193 |