FEATRANKER
Leakage-safe, model-agnostic feature ranking for trustworthy ML workflows.
01 Install │ 02 Quick start │ 03 How it works │ 04 Docs │ Releases
┌────────────────────────────────────────────────────────┐
│ FEATRANKER [ FEATURE RANKING TERMINAL ] │
├────────────────────────────────────────────────────────┤
│ > MODEL ARRAY ............... 40 UNITS [ OK ] │
│ > SEPARATE EVAL SET ......... REQUIRED [ OK ] │
│ > DUMMY BASELINE GATE ....... ARMED [ OK ] │
│ > RANK CONSENSUS ............ ONLINE [ OK ] │
├────────────────────────────────────────────────────────┤
│ READY._ │
└────────────────────────────────────────────────────────┘
FeatRanker trains a set of estimators on explicit training data, measures permutation importance on separate evaluation data, and combines each model's ranking into a single consensus. It is built for ML workflows where leakage control, semantic feature groups, and model failures must stay visible.
▍ Why FeatRanker?
▣ Held-out by designfit() takes training data and rank_features() takes a separate evaluation set. Keeping the two apart is up to you; FeatRanker cannot detect reuse.
|
▣ Semantic feature groupsPermute one-hot, encoded-category, or related feature blocks together with one shared row permutation. |
▣ Rank consensusAggregate per-model ranks, not incomparable raw importance magnitudes. |
▣ Dummy-baseline gateOnly models that strictly beat aDummyClassifier / DummyRegressor vote. If the dummy itself fails, every model votes and the report says so.
|
▣ Parallel & reproduciblen_jobs runs models in parallel with joblib. With seeded estimators and a fixed random_state, reports match the sequential run.
|
▣ Auditable reportsPer-model scores, raw repeat importances, fitted params, version provenance, and structured failures, all as strict JSON. |
Ships with 40 built-in models (22 classification, 18 regression), or bring your own scikit-learn estimators and pipelines.
▍ 01 · Install
pip install featranker
Requires Python ≥ 3.10. Optional extras: featranker[xgboost], [lightgbm], [catboost], or [all].
▍ 02 · Quick start
The caller owns splitting and preprocessing. Fit on training data, then rank on a separate evaluation set. This example runs as is:
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from featranker import FeatureRanker
data = load_diabetes()
X_train, X_eval, y_train, y_eval = train_test_split(
data.data, data.target, test_size=0.3, random_state=0
)
ranker = FeatureRanker(task="reg", group="tree")
ranker.fit(X_train, y_train, feature_names=list(data.feature_names))
report = ranker.rank_features(
X_eval,
y_eval,
scoring="neg_mean_absolute_error",
feature_groups={"serum": ["s1", "s2", "s3", "s4", "s5", "s6"]},
random_state=42,
)
for row in report["consensus"]:
print(f"{row['feature_group']:>6} median rank {row['median_rank']:.1f} ({row['n_models']} models)")
serum median rank 1.0 (7 models)
bmi median rank 2.0 (7 models)
bp median rank 3.0 (7 models)
sex median rank 4.0 (7 models)
age median rank 5.0 (7 models)
Output shown with the xgboost and catboost extras installed; a core-only install has fewer tree models, so n_models is lower. The six blood-serum columns are ranked as one group. The decision tree scored worse than the dummy baseline, so it stays in the report without a vote. See Reading the report for what to do next.
Or from the command line:
featranker --task reg --train-data train.csv --eval-data eval.csv \
--target target --scoring neg_mean_absolute_error --output report.json
▍ 03 · How it works
fit() train every model + a dummy baseline on the training data
rank_features() score every model on the evaluation data
shuffle each feature group n_repeats times, measure the score drop
rank the groups within each model
models that beat the dummy vote -> median / mean rank consensus
For each model, a feature group's importance is how much that model's score drops when the group is shuffled:
importance = model_score - model_score_after_shuffling
Every model uses the same scorer. In the report, the unshuffled score is each model's evaluation_score; baseline_score is the dummy's score, used only for the vote.
Built-in linear models are wrapped in a StandardScaler pipeline fit on training data only; tree models and your own models are used as given.
▍ 04 · Docs
| Page | Contents |
|---|---|
| Usage | API and defaults, choosing a scorer, your own models, parallel runs, the CLI, labels, troubleshooting |
| Report | How to read the results, full report structure, ranking and failure rules |
| Models | All 40 built-in models, optional extras, known issues |
Upgrading from 0.3? The preparation-file workflow was removed in 0.4.0; see the release notes.
▍ Scope
FeatRanker intentionally does not do cross-validation, imputation, feature encoding, automatic feature selection, or SHAP-style attribution. The one target change it makes is encoding classification labels to 0..n_classes-1 internally (see Usage). Results depend on the evaluation sample, scorer, estimators, correlated predictors, and permutation design.
▍ Development
git clone https://github.com/CountZero-Error/Featranker.git
cd Featranker
pip install -e '.[test]'
python -m pytest -q
▍ License
Released under the MIT License.
Metadata
Release files for featranker 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| featranker-0.4.1.tar.gz | 30.8 kB | Without provenance | Details for featranker-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| featranker-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for featranker-0.4.1-py3-none-any.whl |
Total release size: 47.4 kB
Release files / featranker-0.4.1.tar.gz
| Download URL | featranker-0.4.1.tar.gz |
|---|---|
| Size | 30.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
499a418378d48a13e3f3c15353719b45c884c690ee94b13c5135d40454c506d8
|
|
BLAKE2b-256 checksum How to use checksums |
3eda55a3884162eaebdaf87bd934accea122f766a4e98d50d54fb9d7231f2d69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / featranker-0.4.1-py3-none-any.whl
| Download URL | featranker-0.4.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10f131cf4301808d887a3c02f120e5b307c1dfb0905b5ce66d67ea9bee91837f
|
|
BLAKE2b-256 checksum How to use checksums |
7f7669d63000a9333c6e0a2a4e819d3a3aa584fe978b4656bd0935f971415b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for featranker 0.4.1
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.