featureranker
Ensemble feature ranking for any numeric feature matrix: tabular datasets, transformer embeddings, pooled hidden states, engineered features. Five methods rank every feature, a typed result object holds the evidence, and weighted rank voting produces one consensus ordering, for classification and regression. Unnamed matrices work directly: pass a numpy array and features get stable generated IDs.
Featured in:
- Machine learning classifiers predict key genomic and evolutionary traits across the kingdoms of life (Nature Scientific Reports, 2023)
- cdsBERT - Extending Protein Language Models with Codon Awareness (bioRxiv, 2023)
Installation
pip install featureranker
Requires Python >= 3.11.
Quick start
from sklearn.datasets import load_breast_cancer
from featureranker import feature_ranking, voting, plot_rankings, plot_after_vote
cancer = load_breast_cancer(as_frame=True)
result = feature_ranking(cancer.data, cancer.target, task="classification")
vote_table = voting(result) # ["feature", "score"], best first
plot_rankings(result, top_n=15) # per-method ranks as a dot plot
plot_after_vote(vote_table, top_n=15) # consensus scores
feature_ranking returns a RankingResult with per-method ranking tables,
rank and score matrices, diagnostics, and save/load. Results are
deterministic for a given random_state at any n_jobs.
Ranking methods
| Key | Method | Score |
|---|---|---|
rf |
Random forest | Impurity importance from a halving-search-tuned forest |
xg |
XGBoost | Gain importance from a halving-search-tuned booster |
mi |
Mutual information | kNN-estimated dependency with the target |
f_test |
ANOVA F-test | Between/within variance ratio |
l1 |
L1 regularization path | Entry point on the lasso / L1 logistic path |
Examples
Worked run-throughs with plots, each regenerated by a script in examples/:
- Breast cancer classification: named morphology features, full ensemble, consensus and disagreement.
- Diabetes regression: exact L1 path breakpoints on clinical features.
- ModernBERT sentiment: 1,536 unnamed pooled transformer dimensions ranked directly from a numpy matrix; a handful of dimensions carry the signal.
Documentation
| Topic | Page |
|---|---|
| Install and first run | docs/quickstart.md |
| The math behind each method and the voting schemes | docs/algorithms.md |
| Speed, the n_jobs core budget, determinism | docs/performance.md |
| Every signature and exception | docs/api.md |
| Upgrading from v2 | docs/migration_v2_to_v3.md |
| Development and releases | docs/contributing.md |
The example notebook walks through classification and regression end to end.
Development
git clone https://github.com/lhallee/featureranker.git
cd featureranker
pip install -e ".[dev]"
pytest
Citation
@article{Hallee2023,
title = {Machine learning classifiers predict key genomic and evolutionary traits across the kingdoms of life},
volume = {13},
ISSN = {2045-2322},
url = {http://dx.doi.org/10.1038/s41598-023-28965-7},
DOI = {10.1038/s41598-023-28965-7},
number = {1},
journal = {Scientific Reports},
publisher = {Springer Science and Business Media LLC},
author = {Hallee, Logan and Khomtchouk, Bohdan B.},
year = {2023},
month = feb
}
@article{Hallee2023cds,
title = {cdsBERT - Extending Protein Language Models with Codon Awareness},
url = {http://dx.doi.org/10.1101/2023.09.15.558027},
DOI = {10.1101/2023.09.15.558027},
publisher = {Cold Spring Harbor Laboratory},
author = {Hallee, Logan and Rafailidis, Nikolaos and Gleghorn, Jason P.},
year = {2023},
month = sep
}
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file featureranker-3.0.0.tar.gz.
File metadata
- Download URL: featureranker-3.0.0.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe5a9e7752b932a843e9860427282db56f167eb534a2ec11bc1dccd2254eabe0
|
|
| MD5 |
da0463a4b6b691d0e48a6a905bcd90fc
|
|
| BLAKE2b-256 |
e0aa401d741233cdf6881fc87816e52b3bb6eb6aec673a0d3d6bea7629a2b824
|
File details
Details for the file featureranker-3.0.0-py3-none-any.whl.
File metadata
- Download URL: featureranker-3.0.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53228cd4d1592f968a33392131690a3bfdcc5f472bfe1301aa4404d545591955
|
|
| MD5 |
ef2ef1131a12dbbb88f0455c3a74acef
|
|
| BLAKE2b-256 |
0e0a64f45de5edc52dca707cfd3a436ae1035d182e05c8afde1706bd017bc45e
|