Skip to main content

Select features using Kolmogorov–Smirnov (K-S) test for binary classification tasks.

Project description

KSFeatureSelector

KSFeatureSelector is a lightweight Python package for selecting the most discriminatory features in a binary classification problem using the Kolmogorov–Smirnov (K-S) test.

Features

  • Uses the K-S test to rank features by their ability to separate classes.
  • Supports filtering features by:
    • A maximum p-value threshold.
    • A fixed number of top features.
  • Easy-to-read, numpy-style docstrings and validations.
  • Pure Python + pandas + scipy.

Installation

  • bash pip install ksfeatureselector

  • local pip install .

Usage

from ksfeatureselector import select_ks_features

# Your DataFrame `df` should contain numerical features and a binary target column
x_cols = ['feature1', 'feature2', 'feature3']
y_var = 'target'

# Select top features based on p-value or top-n count
select_ks_features(df, x_cols, y_var, top_p=0.05)
# or
select_ks_features(df, x_cols, y_var, top_n=5)

License

- MIT License

Author

-- V Subrahmanya Raghu Ram Kishore Parupudi
-- email: pvsrrkishore@gmail.com

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

ksfeatureselector-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ksfeatureselector-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file ksfeatureselector-0.1.0.tar.gz.

File metadata

  • Download URL: ksfeatureselector-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for ksfeatureselector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b57d1fc6abd06d76a940283d4aa4f8a4599c35cc00499ce94c8387900b8696c8
MD5 a3d3c8f4ab66b15a54bf7f9fcf17a6a9
BLAKE2b-256 830e2f7cec9b07a7c69aedf8e2b5b1061ef46e166066e38b331d0d353e4c92b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ksfeatureselector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 184075e25b0903320ca797688b93ed42108f317f3248a69244a8e535bcf4ce9c
MD5 f33e7d59ba6b0e8d5901a6278c1ea46b
BLAKE2b-256 7ecbe9a7833f4e6683f453981a9e181d8fae15e1772c4d89e3b92db736d0e4b9

See more details on using hashes here.

Supported by

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