Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bio-machine-learning-model-validation

БесплатноЗапускает вложенные скриптыНе проверен

Validates predictive models on omics and biomedical data with nested cross-validation, group/batch/temporal-aware splits, the full data-leakage taxonomy…

lilinjiот lilinji★ 18 звёзд на GitHub

Об этом скилле

Version Compatibility

Reference examples tested with: numpy 1.26+, scikit-learn 1.4+ (note 1.6/1.8 API changes below).

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures

scikit-learn drift to watch: CalibratedClassifierCV(cv='prefit') was deprecated in 1.6 and removed in 1.8 (it now raises; wrap a fitted model in sklearn.frozen.FrozenEstimator instead); ensemble default became 'auto' in 1.6; method='temperature' was added in 1.8. If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Model Validation for Biomedical and Omics Data

"Validate my omics classifier honestly" -> Keep every data-dependent step inside the resampling loop, never use the same data to both choose and grade, and report calibration and net benefit, not just AUC.

  • Nested CV: GridSearchCV (inner) wrapped by cross_val_score (outer)
  • Group/structured: StratifiedGroupKFold, TimeSeriesSplit
  • Calibration: calibration_curve, brier_score_loss, CalibratedClassifierCV

The Single Most Important Modern Insight -- A Reported Number Is an Honest Estimate Only If Nothing Leaked and Nothing Was Graded on What Was Chosen

A reported performance number is a claim about a data-generating process that will never recur. Almost every inflated result in ML-for-biology traces to one of two root causes: information from the test distribution leaked into model construction, or the same data was used to both choose and grade a decision. A clean train/test split is necessary but nowhere near sufficient -- the leakage has usually already contaminated the test set (a scaler fit on all data, a duplicate patient, ComBat run across the split). Leakage causes a reproducibility crisis across ML-based science (Kapoor 2023), and the bias is largest exactly when the true signal is weakest -- the omics regime.

A second, equally load-bearing insight: discrimination (AUC/C) and calibration (do predicted probabilities match observed frequencies) are orthogonal. AUC is invariant to any monotone transform of the score, so it is blind to calibration. For any decision that uses the probability itself, calibration -- not AUC -- is the property that matters, and it is the one routinely ignored (Van Calster 2019, "the Achilles heel").

Leakage Taxonomy

Leakage type How it happens in omics Symptom Prevention
Preprocessing (most common, most missed) z-scoring, quantile/library normalization, ComBat/SVA, PCA, kNN/MICE imputation, VST fit on the full dataset before splitting Test performance suspiciously close to train; collapses on external data Fit every transform inside the CV fold via a Pipeline
Feature selection (severe special case) top-k DE genes / highest-variance / univariate filter chosen on all samples, then CV only the classifier Near-perfect CV from pure noise; unstable selected set Selection lives in the CV fold (Ambroise 2002)
Target / label a feature is a proxy for or downstream of the outcome (post-diagnosis labs, treatment-derived fields, a collection-site that tracks case/control) One feature dominates implausibly; fails when removed Audit temporal/causal admissibility; exclude post-outcome variables
Group / patient / replicate same patient, tumor, organoid, or technical replicate in train and test; KFold scatters them Inflated metrics that vanish under leave-one-group-out Split by the highest independent unit (GroupKFold/StratifiedGroupKFold)
Batch batch correlated with outcome and not respected in the split, or ComBat across the train/test boundary Model discriminates batches not biology; external batch destroys it Block the split by batch; never run unsupervised correction across the split
Temporal random-splitting time-ordered data; future-period statistics standardize the past Backtest beats prospective deployment Time-based split (TimeSeriesSplit); never shuffle first
Duplicate / homolog near-identical samples, augmented copies, public-dataset overlap, homologous sequences across the split Memorization passes as generalization Deduplicate / cluster-then-split before CV
Test-reuse / threshold repeatedly peeking to pick features, thresholds, "best epoch"; choosing the classification threshold on the test set Irreproducible SOTA; fragile config One locked test set; all tuning + thresholds inside nested CV

Decision Tree by Scenario

Scenario / generalization question Recommended scheme Why
"A new sample like training" (and any tuning occurs) Nested CV: inner GridSearchCV, outer cross_val_score, Pipeline inside Tuning and grading on the same CV is optimistic
Полный SKILL.md на GitHub

Установить bio-machine-learning-model-validation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/nested_cv_biomarker.pyusage-guide.md

FAQ

Что делает скилл bio-machine-learning-model-validation?

Validates predictive models on omics and biomedical data with nested cross-validation, group/batch/temporal-aware splits, the full data-leakage taxonomy, probability calibration, decision-curve net benefit, optimism correction, sample-size planning, and TRIPOD+AI reporting. Use when estimating model performance honestly, choosing a CV scheme, detecting leakage, or judging whether reported discrimination means the model is actually useful. For feature selection itself see machine-learning/biomarker-discovery; for confirmatory-trial inference see clinical-biostatistics/trial-reporting.

Как установить скилл bio-machine-learning-model-validation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bio-machine-learning-model-validation запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить bio-machine-learning-model-validation с