Repository navigation
Releases
Releases · CountZero-Error/Featranker
v1.21.2
Fixes from an independent review of 1.21.1. Normal rankings are unchanged; the fixes close silent-failure paths.
pip install -U featranker
Fixes
- Models can no longer corrupt each other. Every model fits and scores on read-only views of the shared arrays (array and
model_input="dataframe", SHAP evidence included). A model that writes to its input now fails alone instead of silently changing later models' scores. Some scikit-learn linear models (Ridge; LinearRegression on 1.9) copy the read-only input once while fitting: about +17% peak memory on 1e5 × 200, no runtime change. - Opaque transformers are unverified for shadows. A
FunctionTransformerwith a function, or a transformer scikit-learn does not define, anywhere in a model (later pipeline steps,GridSearchCV,BaggingRegressor,TransformedTargetRegressor's regressor) leaves that model out of the shadow evidence with ashadowsfailure. Target transformers are not affected. Rankings are unchanged. - Shadow rules without shadow evidence (
min_shadow_share,max_shadow_q,min_shadow_families) raise a clearValueErrorinstead ofKeyError. - Repeated
cvsplits raiseValueError. A repeated split added no data but shrank shadow q-values. max_shadow_qis experimental. Using it warns that shadow q-values are uncalibrated;shadow_testrecords"experimental": true.ablate()checks model parameters against the report (raises on a mismatch; warns when the report came from another scikit-learn version).- Strict JSON with NumPy integers:
random_state,shadow_seed,n_repeats,top_kand similar arguments are recorded as plain ints. - CLI checks the output path before ranking and reports write errors without a traceback.
- The calibration harness test is repaired and
benchmarks/tests run in CI.
Behaviour changes
cvwith identical splits now raises.- Pipelines with custom transformers no longer count toward shadow rules; with only such models, shadow rules raise.
shadow_seed,n_repeatsandtop_kaccept NumPy integers.
FeatRanker 1.21.1
First release on GitHub since 0.4.1. It carries every version from 0.5 to 1.21.1 (most of which were never published separately). Full per-version notes are in the docs; highlights below.
pip install -U featranker
pip install -U "featranker[all,shap,plot]" # XGBoost, CatBoost, SHAP evidence, plots
Requires Python ≥ 3.10 and scikit-learn ≥ 1.5.
Highlights since 0.4.1
Ranking you can trust
- Family-aware consensus: each model family casts one vote;
families=groups your own models. - Resampled ranking (
rank_resampled) with per-split stability. - Shadow features: per-family shares, a binomial hits test with BH q-values (labelled uncalibrated), and a check that every model actually keeps the shadow columns (nested
ColumnTransformers, selectors, unions, meta-estimators). - Dummy-baseline gate, structured failures, and a
runblock that fingerprints data, labels, weights and splits.
Using the answer
ConsensusSelector: a scikit-learn selector, safe inside nested cross-validation.ablate(): refit on the top-k groups and score each k, with provenance and a paired curve.summarize()findings,Report.plot(),to_frame().- Evidence: train score, overfit gap, correlated groups, SHAP for linear and tree models.
Real-world data
- Missing values (
missing="impute"), categorical columns (categorical=[...]or"auto"), named model input (model_input="dataframe"), sample weights end to end. - Grouped or time-ordered rows:
shuffle="within_groups"/"circular", with a warning for groups that cannot be measured that way. - Multiple scorers with shared predictions.
- Large data:
max_samples(scoring),fit(max_samples=)(training),max_categories(one-hot cap); lower memory peaks for shadows and correlations.
CLI: featranker --train-data … --eval-data … --target … --scoring …, plus --drop, --ablate, --categorical, --missing, --sample-weight, --max-categories, --max-train-samples.
1.21.1 fixes
- Shadow check marks models unverified when a selector,
FeatureUnionorColumnTransformerfollows an untracked step or sits inside a meta-estimator. - Prediction sharing only for scikit-learn's own scorer class; custom subclasses are called directly.
ablate()checks training rows in both directions.- Consistent fingerprint scheme for shuffle labels in old pickles; Spearman keeps float32 ranks on newer SciPy.
- Resampled
constant_within_groupsfinding names the affected splits. - Compatibility with scikit-learn 1.9 and Python 3.10 in the test suite.
Upgrading from 0.4.1
- scikit-learn ≥ 1.5 is required.
- The
lightgbmextra was removed (no built-in model used it);allinstalls XGBoost and CatBoost. explain()andto_prompt()are deprecated (removal in 2.0).rank_features()returns aReport, adictsubclass; dict use is unchanged.- Report fingerprints of integer and boolean data changed in 1.17 (lossless hashing); compare runs within the same scheme (
run.fingerprint_scheme).
Known limitations
- The shadow hits test is not calibrated for arbitrary estimators or overlapping splits.
- SHAP evidence covers linear and tree models only.
- Custom transformers that drop columns (other than selectors) are assumed to use every column by the shadow check.
- The calibration and benchmark studies predate 1.17.
Docs: Usage · Report · API and stability
v0.4.1
Fixed
- Built-in
sgd_classifier,passive_aggressive,perceptron,linear_svm, and thesagalogistic models were unseeded, so their scores changed between runs. They now userandom_state=42like the other models; their scores differ from 0.4.0.
Docs
- README restyled and slimmed; reference material moved to
docs/: usage, report reading guide, models, and troubleshooting.
FeatRanker v0.4.0
Added
- Dummy baseline (
DummyClassifier/DummyRegressor): only models that strictly beat it vote in the consensus. Reports gainbaseline_scoreand per-modelin_consensus; an empty consensus warns. FeatureRanker(models={...})to rank with your own estimators or Pipelines (cloned atfit()).n_jobs/--n-jobsto fit and rank models in parallel with results identical to sequential runs.- Report
provenance(featranker, Python, NumPy, scikit-learn versions) and per-model JSON-safeparams. - End-to-end tests of the shipped model registry; CI matrix over Python 3.10–3.13 and scikit-learn 1.5.x/latest.
Changed
- Built-in linear models standardize features internally (
StandardScalerfit on training data only). - Permutation reuses one scratch matrix per model (same results, less copying).
- CLI moved to
featranker/cli.py(console scriptfeatranker.cli:main); CSV flags are argparse-required and no arguments prints help. - Every classification target is label-encoded to 0..n-1; regression targets must be numeric.
- CSV targets are typed by
--task, so train/eval label sets stay comparable.
Fixed
- Longer unseen eval labels were silently truncated to the training label width and accepted.
- Mixed numeric/text targets across train and eval CSVs produced all-zero scores without error.
- L1/elastic-net logistic models silently ran as L2 on scikit-learn < 1.8.
- XGBoost failed on classification labels not starting at 0.
pls_da(PLSRegression) removed: it is not a classifier.- A failed refit left the ranker marked fitted.
- NaN/inf features are rejected; CSV BOMs and blank lines are handled; invalid scorer,
n_repeats, or feature groups fail before any model is fit. - Build requires setuptools>=77 for the SPDX license field.
Removed
- Legacy preparation workflow:
build_ranker(),run_ML(),rankFeatures(),prep_file/prep_class,--prep-file/--prep-class, in-sampleevaluation_mode, andfeatranker.importance.main.
Known issues
- CatBoost 1.2.8 lacks
__sklearn_tags__; scikit-learn 1.8 may turn the current deprecation warning into per-model failures.
Full Changelog: v0.3.0...v0.4.0
FeatRanker v0.3.0
Full Changelog: v0.2.0...v0.3.0
FeatRanker v0.2.0
Full Changelog: https://github.com/CountZero-Error/Featranker/commits/v0.2.0