Skip to main content

Fast-Select: Accelerated Feature Selection for Modern Datasets

PyPI version Build Status codecov Python Versions License: MIT Code style: black Code style: ruff DOI Downloads

A high-performance Python library powered by Numba and CUDA, offering accelerated algorithms for feature selection. Initially built to optimize the complete Relief family of algorithms, fast-select aims to expand and accelerate a wide range of feature selection methods to empower machine learning on large-scale datasets.


Key Features

  • Fast Performance: Leverages Numba for JIT compilation and thread-parallel CPU kernels, and Numba CUDA for GPU acceleration, scaling with modern hardware.

  • ML Pipeline Integration: Fully compatible with Scikit-Learn, making it easy to fit into any machine learning pipeline with a familiar .fit(), .transform(), .fit_transform() interface.

  • Flexible Backends: Offers dual execution modes for both CPU (Numba prange) and GPU (CUDA). Automatically detects hardware with an easy-to-use backend parameter.

  • Feature-Rich Implementation: Provides highly optimized implementations of ReliefF, SURF, SURF*, MultiSURF, MultiSURF*, and TuRF, with plans to support additional feature selection algorithms in future releases.

  • Paper-Faithful: Every algorithm is verified against independent, equation-driven tests derived from its defining paper, not from another library's output. Where an extension goes beyond the published algorithm, the docstring says so.

  • Lightweight & Simple: Depends only on NumPy, Numba, SciPy, and scikit-learn. No TensorFlow, no PyTorch, no CuPy.


Table of Contents

  1. Installation
  2. Quickstart
  3. Backend Selection
  4. Benchmarking Highlights
  5. Algorithm Implementations
  6. Versioning and Stability
  7. Contributing
  8. License
  9. How to Cite
  10. Acknowledgments

Installation

Supports standard CPython 3.9–3.14. CI runs the test suite on each of these versions. Python 3.13 requires Numba 0.61 or newer, and Python 3.14 requires Numba 0.63 or newer; pip selects these automatically. Python prereleases and free-threaded builds are not currently part of the supported test matrix.

Install fast-select directly from PyPI:

pip install fast-select

That single command gives you the full library, CPU backend included.

GPU support needs no extra Python package. The CUDA kernels are compiled by numba.cuda, so all that is required is an NVIDIA GPU with a current driver and a CUDA toolkit that your installed Numba supports. Check that the backend is visible with:

python -c "from fast_select.utils import is_cuda_ready; print(is_cuda_ready())"

For a development checkout (tests, linters, and documentation tooling):

git clone https://github.com/GavinLynch04/FastSelect.git
cd FastSelect
pip install -e ".[dev]"

Quickstart

Using fast-select is simple and seamless for anyone familiar with Scikit-Learn.

from fast_select import MultiSURF
from sklearn.datasets import make_classification
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

# 1. Generate a synthetic dataset
X, y = make_classification(
    n_samples=500, 
    n_features=1000, 
    n_informative=20, 
    n_redundant=100, 
    random_state=42
)

# 2. Use the MultiSURF estimator to select the top 15 features
selector = MultiSURF(n_features_to_select=15)
X_selected = selector.fit_transform(X, y)
print(f"Original feature count: {X.shape[1]}")
print(f"Selected feature count: {X_selected.shape[1]}")
print(f"Top 15 feature indices: {selector.top_features_}")

# 3. Integrate into a Scikit-Learn Pipeline
pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('feature_selector', MultiSURF(n_features_to_select=10, backend='cpu')),
    ('classifier', LogisticRegression())
])

# Fit the pipeline
# pipeline.fit(X, y)

Backend Selection (CPU vs. GPU)

You can control the computational backend with the backend parameter during initialization:

  • backend='auto': Automatically detects if an NVIDIA GPU is available. Falls back to CPU if a GPU is not available.

  • backend='gpu': Explicitly runs on GPU. Will raise a RuntimeError if no compatible GPU is found.

  • backend='cpu': Forces CPU computations, even if a GPU is available.

For the mutual-information selectors (mRMR) the CUDA kernels support up to 32 distinct states in the encoded data. With backend='auto' more states than that fall back to the CPU, and backend='gpu' raises instead of falling back. After fit, effective_backend_ reports which backend actually ran.

Example usage:

# Force CPU usage
cpu_selector = MultiSURF(n_features_to_select=10, backend='cpu')

# Force GPU usage
gpu_selector = MultiSURF(n_features_to_select=10, backend='gpu')

Benchmarking Highlights

Fast-Select delivers substantial runtime and memory improvements through its Numba and CUDA kernels. CPU and GPU paths are checked against independent, equation-driven algorithm tests rather than assuming an external implementation is authoritative. Sustained comparison scripts and raw results are available in the benchmarking directory.

Runtime vs. Number of Samples (n >> p)

Runtime Benchmark N-Dominant

Runtime vs. Number of Features (p >> n)

Runtime Benchmark P-Dominant


Algorithm Implementations

Currently supported:

  • Relief-Family Algorithms:
    • ReliefF
    • SURF
    • SURF*
    • MultiSURF
    • MultiSURF*
    • TuRF
  • Correlation-Based Feature Selection (CFS)
  • Multifactor Dimensionality Reduction (MDR)
  • Minimum Redundancy Maximum Relevance (mRMR)
  • Chi Squared (Chi2)
  • Discrete mutual information — calculate_mi_single_pair and calculate_mi_matrices, with the same CPU/GPU backend selection and a choice of bit or nat units.

Each implementation is held to its defining paper. Where fast-select supports more than the paper does — multiclass targets for the SURF family, for instance — the docstring names it as an extension rather than presenting it as the original algorithm. The rules are written down in CLAUDE.md and enforced by tests/test_algorithm_compliance.py, whose oracles are computed straight from the published equations and never call production kernels.

Future plans include additional feature selection algorithms, such as wrappers, embedded methods, and more filter-based approaches.


Versioning and Stability

fast-select follows Semantic Versioning and is currently a 0.x release series: estimator names, constructor parameters, and fitted attributes may still change between minor versions, and every change is listed in the changelog. A 1.0.0 release will follow once the CUDA backend has been verified on physical NVIDIA hardware and the support matrix is final.

Upgrading from 0.2.x: v0.3.0 corrects several algorithms that had drifted from their defining papers and fixes numerical-precision and input-validation defects, so ReliefF, SURF, SURF*, MultiSURF, MultiSURF*, CFS, MDR, mRMR, and GPU mutual information can return different scores and different selected features than 0.2.1 did. pandas is also no longer a required dependency. See the changelog for the full list before comparing new output against results you generated with an earlier release.

Support matrix.

Area Verified in CI Not verified
Python CPython 3.9–3.14, Linux x86-64 Free-threaded builds, prereleases, minimum-dependency pins
Operating system Linux Windows, macOS (the Windows CUDA context workaround is untested in CI)
CPU backend Full test suite, independent equation oracles —
CUDA backend Kernel logic in the Numba CUDA simulator, against the CPU backend and oracles Physical NVIDIA GPUs: drivers, races, device-level rounding, performance
Documentation Strict Sphinx build (warnings are errors) —

Reported test coverage is host-side Python line coverage only; the compiled numerical kernels are excluded from it and are verified by the oracle tests.

Numerical policy. Relief-family features are range-normalised in float64 (continuous) or replaced by exact category codes (discrete) before any narrowing to float32, on both the CPU and CUDA backends. SURF and SURF* compute the global radius and all pair distances in float64 and treat a distance within a relative 1e-12 of the radius as a tie, which is excluded from both the near and far sets; the remaining Relief-family kernels score in float32.


Contributing

Contributions are highly encouraged. Whether you're fixing bugs, improving performance, or proposing new algorithms, your work is invaluable.

Before opening a pull request:

pip install -e ".[dev]"
ruff check src tests benchmarking
black --check src tests benchmarking
pytest

Algorithm changes carry an extra requirement: cite the paper and the specific equation or pseudocode rule you are implementing, and add an independent oracle test that derives the expected result from that equation rather than from fast-select's own output. CLAUDE.md has the details.


License

This project is licensed under the MIT License. See the LICENSE file for full details.


Citing fast-select

If you use fast-select in your research or work, please cite it and state the version you used (fast_select.__version__). The DOI below is the Zenodo concept DOI: it always resolves to the newest archived release. Each release also has its own version-specific DOI on the Zenodo record, which you can cite instead for exact reproducibility.

Gavin Lynch. FastSelect. Zenodo. https://doi.org/10.5281/zenodo.16285073

@software{lynch_fast_select,
  author  = {Gavin Lynch},
  title   = {{FastSelect}},
  year    = {2026},
  version = {<the version you used>},
  publisher = {Zenodo},
  doi     = {10.5281/zenodo.16285073},
  url     = {https://doi.org/10.5281/zenodo.16285073}
}

Acknowledgments

This library builds on the exceptional work of the following:

  • The Numba team for enabling JIT compilation and GPU acceleration.
  • The scikit-rebate authors for their inspiring Relief-based library.
  • The original researchers behind the Relief algorithms for their foundational contributions to feature selection.
  • The original authors and researchers behind the various algorithms implemented in this library.

Metadata

Release files for fast-select 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fast-select 0.3.0
File Size Uploaded Provenance Actions
fast_select-0.3.0.tar.gz 74.1 kB Without provenance Details for fast_select-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fast-select 0.3.0
File Interpreter ABI Platform Actions
fast_select-0.3.0-py3-none-any.whl Python 3 none any Details for fast_select-0.3.0-py3-none-any.whl

Total release size: 123.1 kB

Release files / fast_select-0.3.0.tar.gz

Download URL fast_select-0.3.0.tar.gz
Size 74.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6e8b7c59c774f0e54b7632819fcdd009cc68f87db8e8a25b73bd26be5dade286
BLAKE2b-256 checksum
How to use checksums
f721b9c6c2332bdd5293308525cdecc2b53fe49e252b7b821ffc7afc09f4b348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fast_select-0.3.0-py3-none-any.whl

Download URL fast_select-0.3.0-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7ae5e3e6f6238e4ee17c556d23a73717e22917a81a8af1a1febf6bc6ddf3edc
BLAKE2b-256 checksum
How to use checksums
1eaf146abee98186ae1ca16a148d0ce8ca64cc9eeb072ab5b2397fa1a3fab909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for fast-select 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page