Skip to main content

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 -r requirements.txt

How to use?

Load model selection class from the package

from src.featureSelector import FeatureModelSelection
FeatureModelSelection(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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ml_feature_selector-0.1.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

ml_feature_selector-0.1.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file ml_feature_selector-0.1.2.tar.gz.

File metadata

  • Download URL: ml_feature_selector-0.1.2.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

Hashes for ml_feature_selector-0.1.2.tar.gz
Algorithm Hash digest
SHA256 315af7e4d2688b2f7caf87c9a83e51e32b777d7e91acd1f8388c6596f9f170ba
MD5 eb1dd4ba4f259f76f23d93ccd840168a
BLAKE2b-256 8c4116f88987922fe8da85105c18c12798314d4b355d32b72c36224b5e9fe1f4

See more details on using hashes here.

File details

Details for the file ml_feature_selector-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ml_feature_selector-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 746578ca4cfd9a2d528565b3a7d6dd3f979f2e9ef118dc818c5498073ea9abe7
MD5 6d5e4c185d95a17d84f6f3cd14f1ea00
BLAKE2b-256 a21639decbf0350482210773c6329b785d3ccd9901a3030d1cd6c6f153d60293

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