Classical machine learning standards (tabular)
Criteria verified as of August 2026. Re-verify on the web before committing to anything (§8).
1. Scope and triggers
Applies to building and evaluating a non-deep predictive model on structured data: whether
a model is needed at all, splitting, leakage, validation, metrics and threshold, calibration, model
family, features, imbalance, interpretability and time series.
Triggers: sklearn, Pipeline, ColumnTransformer, train_test_split, StratifiedKFold,
GroupKFold, TimeSeriesSplit, cross_val_score, xgboost, lightgbm, catboost,
HistGradientBoostingClassifier, LogisticRegression, statsmodels, roc_auc_score,
average_precision_score, brier_score_loss, CalibratedClassifierCV, feature_importances_,
permutation_importance, shap, imblearn/SMOTE, joblib.dump, "0.99 accuracy", "imbalanced
classes", "which threshold do I set?", "the probabilities do not add up", "leakage", "backtest",
"predict churn / default / fraud / demand".
Domain thesis — it orders the rest of the document:
- The first question is not which model, but whether a model is needed at all. A business rule,
a heuristic or a SQL query solves a good part of what arrives labelled as an "ML case",
with almost zero operational cost and auditable behaviour (§2.0).
- In tabular data, classical ML is still the default — by comparative evidence (§2.1) and
by inference cost, training time and debuggability.
- Data leakage is the number one cause of fake models: excellent metrics
in validation and useless ones in production almost always mean the model saw something
that will not exist at prediction time.
- A number without a baseline means nothing. AUC 0.84 can be excellent or worse than
always predicting the majority class; without a baseline there is no way to know which.
classical-ml is not "small deep learning": it is another family of models, with other
assumptions, other failure modes and another economics.
Not applicable:
mlops-standards (written — critical boundary): the model's lifecycle in
production is theirs — data and experiment versioning, registry, feature store,
deployment, train/serve skew, drift, retraining and retirement. Here, how the model is trained and
evaluated before getting there. Arbitration: "is it good and why should I believe it?" belongs
here; "how do I promote it, watch it and roll it back?" is theirs. Fairness and the threshold are
computed here; monitoring them over time is theirs.
deep-learning-standards and model-finetuning-standards (this same wave): your own deep
networks and modification of pretrained weights. The boundary is the model family, not the
data domain: if you are going to train a network on tabular data, the justification against
gradient boosting is required here (§2.1) and the training mechanics live there.
llm-app-engineering-standards, rag-standards, llm-evaluation-standards,
ai-agents-standards (written): everything that happens on top of a third-party LLM. Practical
boundary: a tabular classification with historical labels is not a job for an LLM;
free text without labels is not a job for this skill.
data-engineering-standards, data-governance-quality-standards,
data-warehouse-modeling-standards, sql-standards (written): the pipeline, the contract,
the quality, the grain and the query. Here it is required that the training data have a
stable definition and a reliable timestamp; producing it is theirs. If the solution was a
GROUP BY, §2.0 rules and the implementation is theirs.
privacy-engineering-standards (personal data in the training set: lawfulness,
minimisation, retention, DPIA and erasure on an already-trained model — here only asking
the question before training is required) and ai-governance-standards (risk classification,
AI Act and inventory: a threshold that denies credit or filters candidates is a regulated decision —
the number is computed here, acceptability is decided there).
analytics-bi-standards (dashboard, not automated prediction); python-standards,
r-standards, julia-standards (language and environment); finops-standards, green-it-standards
(cost and footprint); mlsecops-standards (poisoning, provenance, attacks);
gpu-computing-standards (the GPU as a resource); computer-vision-standards, nlp-standards,
multimodal-genai-standards (applications per modality).
2. Default decisions
Verify the latest version on the web before pinning it in a real project (§8).
2.0 Is a model needed? (mandatory gate)
| Situation |
Correct solution |
| An expert can write the rule and it fits in 10 conditions |
Business rule, versioned in code |
| The criterion is an aggregate or a ranking over existing data |
SQL query / view |
| There is weak signal but the volume of decisions is low and the cost of error high |
Heuristic + human review |
| There are no labels, or there are <1000 and they are noisy |
There is no model: instrument and label first |
| Multivariate relationship, abundant labels, repetitive and error-tolerant decision |
Model |
Hard rule: a model introduces retraining, monitoring, drift and an explanation
surface towards the customer; if a rule obtains most of the benefit, the model must
justify the rest against that permanent cost.
2.1 Tabular: classical as the default — the evidence
- Grinsztajn, Oyallon and Varoquaux, "Why do tree-based models still outperform deep learning on
tabular data?" (arXiv:2207.08815, v1 18 Jul 2022). Methodology, verbatim: "We define a
standard set of 45 datasets from varied domains with clear characteristics of tabular data and
a benchmarking methodology accounting for both fitting models and finding good
hyperparameters"; conclusion verbatim: "tree-based models remain state-of-the-art on
medium-sized data (~10K samples) even without accounting for their superior speed". Limit
declared by the authors: medium size (~10K).
- Erickson et al., TabArena: A Living Benchmark for Machine Learning on Tabular Data
(arXiv:2506.16791, v1 20 Jun 2025, v4 3 Nov 2025). Verbatim: "While gradient-boosted trees are
still strong contenders on practical tabular datasets, we observe that deep learning methods
have caught up under larger time budgets with ensembling. At the same time, foundation models
excel on smaller datasets."; and their own warning: "some deep learning models are
overrepresented in cross-model ensembles due to validation set overfitting".
Read this as criteria, not as a headline: gradient boosting is the correct starting point in
tabular data, and the one that loses the comparison is the network with the compute and ensembling
budget of a real project, not that of a paper. Tabular foundation models (the TabPFN line) are
a moving front and their strongest figures come from reports by their own authors:
they are not cited here as established — measure on your own dataset against a tuned GBDT (§8).
2.2 Toolchain
| Piece |
Choice |
Verified version (Aug 2026) |
Licence (read in the repo) |
| Base |
scikit-learn |
1.9.0 (2 Jun 2026, PyPI) |
BSD-3-Clause |
| General GBDT |
XGBoost |
3.4.0 (4 Aug 2026, PyPI; requires Python ≥3.12) |
Apache-2.0 |
| Fast GBDT / large volume |
LightGBM |
4.7.0 (18 Jul 2026, PyPI) |
MIT |
| GBDT with native categoricals |
CatBoost |
1.2.10 (18 Feb 2026, PyPI) |
Apache-2.0 (© 2017-2026 YANDEX LLC) |
| Explainability |
SHAP |
0.52.0 (28 May 2026, PyPI) |
MIT |
| Statistical inference / CI |
statsmodels |
verify |
verify |
- The three boosting libraries are permissive and suitable for commercial use. LightGBM is MIT, without the
patent grant that Apache-2.0 gives (XGBoost, CatBoost): if your policy requires a patent
grant, that decides it (
opensource-licensing-standards).
- Verified change of origin: LightGBM is no longer published from
microsoft/LightGBM; PyPI
4.7.0 points to github.com/lightgbm-org/LightGBM, whose raw LICENSE keeps MIT with
copyright by Microsoft and "The LightGBM developers". Update URLs, SBOM and pins.
- Without a GPU and with a medium-sized dataset,
HistGradientBoostingClassifier avoids a whole
dependency. Adding XGBoost/LightGBM/CatBoost is justified by measured performance, native
categoricals or distributed training, not by habit.
3. Minimum defensible workflow
- Decision unit and prediction instant: what is predicted, for whom, when and with what
information available at that moment. Without this there is no correct dataset.
- Split the data BEFORE looking at anything: exploration, statistics, feature selection and
imputation are decided on the training set; the test set is separated first and is not touched (§7).
- Dumb baseline (majority class, mean, "the same as yesterday", the rule in production) and
honest baseline (regularised regression or a single tree, inside the
Pipeline).
- Candidate model: gradient boosting, with validation appropriate to the data (§4.2).
- Calibration and threshold (§4.3, §4.4) and a single evaluation on the test set, with the baseline alongside.
All preprocessing lives inside the Pipeline/ColumnTransformer that is fitted in each
fold: a fit_transform over the full dataset before splitting is leakage, even if it is "only"
a StandardScaler.
4. Validation, metrics and threshold
4.1 Data leakage — the three cases that produce almost every fake model
- Temporal leakage: a feature that will not yet exist in production, or computed with
information later than the prediction instant (aggregates over "the whole history", columns
updated in place, tables without versioning). Symptom: unrealistic metrics and a dominant
variable that "makes sense" after the fact.
- Leakage from preprocessing fitted on the whole set: scaling, imputing with the global
mean, selecting features or encoding the target using the validation set too. The target
encoding is the most treacherous case: it requires out-of-fold encoding.
- Identifier leakage: an
id, hash, case number or sequential code that encodes the
order or the class; it gives itself away as a causally meaningless variable high up in importance.
- Detection: if the model beats the baseline by a surprising margin, the default
hypothesis is leakage, not talent. Reproduce it with a real temporal cut before celebrating.
4.2 Validation
| Data structure |
Correct split |
Forbidden |
| i.i.d., balanced classes |
K-fold |
— |
| i.i.d., imbalanced classes |
Stratified K-fold |
— |
| Several rows per entity (customer, patient, device) |
GroupKFold / StratifiedGroupKFold by entity |
Random split: the same entity in train and test |
| Temporal |
Walk-forward validation, cut by date, TimeSeriesSplit |
Random split: training with the future |
| Hyperparameter selection + error estimation |
Nested cross-validation |
Reporting the best CV as an unbiased estimate |
A random split is incorrect on temporal or grouped data, and it produces
exactly the same symptom as leakage: a number that does not reproduce in production.
4.3 Metrics with judgement
- Accuracy is useless with imbalanced classes: at 1 % positives,
always predicting "negative" gives 99 %. It is never reported on its own.
- Precision / recall / F1: they are chosen by the asymmetric cost of the error. F1 has no
business meaning of its own: it is for comparing, not for justifying.
- ROC versus precision-recall: with scarce positives the ROC is optimistic (the false
positive rate is diluted in a huge denominator). With strong imbalance the precision-recall curve
and its average precision rule, with the prevalence written alongside as a baseline.
- Calibration: what almost nobody measures and what the business needs. If the model says 0.7,
does it happen 70 % of the time? It is measured with the Brier score and a reliability diagram and corrected
with calibration (Platt/isotonic) fitted on a separate set. Good discrimination with
poor calibration is useless for any decision that multiplies probability by an amount.
- Regression: MAE/RMSE depending on whether you penalise the large error; MAPE breaks with zeros and small
values. Report in business units alongside the baseline.
4.4 The threshold is a product decision
The model produces a probability; the threshold turns it into an action and belongs to whoever bears
the cost of the error, not to whoever trains it. It is set with the cost matrix (false positive ×
volume against false negative × volume) or with an operational constraint (cases reviewable per
day), it is chosen on validation, it is declared and it is versioned alongside the model. Choosing it by looking at the
test set invalidates the error estimate (§7).
4.5 CI gates, in order of cost
- A test that fails if there is a
fit/fit_transform outside the Pipeline or before the split.
- Dataset schema: columns, types, ranges, expected nulls.
- No-leakage: forbidden columns excluded; an alert if a variable exceeds an absurd importance
threshold.
- Validation metric against the baseline, with a threshold that breaks the build.
- Fixed seed and the same metric across two runs.
5. Data, features and imbalance
- Feature engineering and leakage are the same problem seen twice. Every
feature requires answering: does this value exist at the prediction instant, with that
latency and computed only from the past? Focus on temporal aggregates: a closed window
before the cut.
- High-cardinality categoricals: native ones in CatBoost/LightGBM or out-of-fold target
encoding.
OneHotEncoder over thousands of levels is a cost mistake.
- Imbalance: first ask whether it is a real problem or just low prevalence. With GBDT,
scale_pos_weight/class weights and an appropriate metric (§4.3) usually suffice.
- Synthetic resampling worsens calibration. van den Goorbergh, van Smeden, Timmerman and
Van Calster, JAMIA 29(9):1525-1534 (2022), doi:10.1093/jamia/ocac093. Methodology: standard and
ridge logistic regression under four treatments (no correction, undersampling,
oversampling and SMOTE), evaluated on discrimination, calibration and classification, with
Monte Carlo simulation varying size, number of predictors and event fraction.
Result: the corrections damage calibration by overestimating the minority class, with no
benefit in discrimination. Declared discrepancy: the follow-up on ML algorithms
(Carriero et al., Statistics in Medicine, 2025) does not generalise it to every algorithm (§8).
Criteria: SMOTE is not the default step; if you use it, measure calibration before and after.
- PII in the training set: lawfulness, minimisation and retention are decided in
privacy-engineering-standards before building the dataset.
6. Interpretability and time series
- Explaining the model ≠ explaining the decision. Global importance describes the model; the
person you are denying something asks about their case. Two different deliverables, and the second
is usually the legally mandatory one.
- Importance traps: split/gain importance favours high cardinality and is
distributed arbitrarily among correlated variables; permutation importance is preferable, it
degrades with strong correlation and must be computed on unseen data.
- SHAP and its limits: additive local attribution, with independence assumptions in its
usual approximations and a real compute cost. It is not a causal measure nor does it say what would happen
if you changed the variable: it is for debugging and explaining a case, not for arguing for an intervention.
- When interpretability rules, a linear model is preferable: coefficients with
intervals and stable behaviour. In regulated domains, the AUC difference against a
GBDT rarely compensates for losing defensibility.
- Time series: walk-forward validation with retraining at each cut; lags and
rolling windows computed only from the past; seasonality and calendar as explicit
variables; declared horizon. Mandatory baseline: naïve and seasonal naïve.
7. Sustainability and prohibitions
- Review major versions of scikit-learn and of the boosting libraries every quarter. A model serialised
with
pickle/joblib is not portable across versions: pin the version alongside the artifact and
test loading it in CI. Retraining, drift and retirement: mlops-standards.
FORBIDDEN:
- ❌ Evaluating on the training data and presenting that metric as the result.
- ❌ Choosing the threshold by looking at the test set (or any hyperparameter).
- ❌ Presenting metrics without a baseline or without the prevalence of the positive class.
- ❌ Using feature importance as causality ("variable X causes churn").
- ❌ Fitting any transformation on the full set before splitting.
- ❌ A random split with temporal data or with several rows per entity.
- ❌ Reporting accuracy as the main metric under imbalance, or AUC-ROC as the only metric with
low prevalence.
- ❌ Delivering probabilities without measuring calibration when they feed an economic decision.
- ❌ Touching the test set more than once, or "trying another idea" on it.
- ❌ Training a model when a rule, a query or a heuristic solved the case.
- ❌ Benchmark figures without measurement conditions: dataset, split, tuning budget
and baseline.
8. Mandatory web verification
Before committing anything in a real project, check on the web:
- Latest stable version and Python support of scikit-learn, XGBoost, LightGBM, CatBoost, SHAP and
statsmodels; XGBoost 3.4.0 already requires Python ≥3.12. Breaking API changes before moving up a
major version.
- The origin and licence of each library read in the repo's raw
LICENSE, not in a
summary. LightGBM changed organisation (microsoft/ → lightgbm-org/).
- State of the tabular classical-vs-deep literature: the
tabarena.ai scoreboard and
publications after Nov 2025. Tabular foundation models move fast and
their most favourable figures come from their own authors: demand methodology, compute
budget and independent evaluation before citing them.
- Declared gaps: (a) no comparative performance figure (AUC, Elo, leaderboard
positions) is pinned here — the available ones lack homogeneous measurement conditions and
independent evaluation; (b) the version and licence of
statsmodels and imbalanced-learn were not
verified in this draft.
- Declared discrepancy: van den Goorbergh et al. (2022) concludes against imbalance
corrections in logistic regression; the follow-up by Carriero et al. (2025) does not generalise it to
every ML algorithm. Check the current status and measure calibration in your case.
If the web contradicts this document, the web wins — flag the discrepancy.
1---2name: classical-ml-standards3description: Classical (non-deep) machine learning on tabular data as an engineering discipline. Use when deciding whether a model is needed at all instead of a SQL query, a business rule or a heuristic, splitting data with train_test_split, StratifiedKFold, GroupKFold, TimeSeriesSplit or nested cross-validation, hunting data leakage from a scaler fit on the full dataset, a target-encoded column, an ID column or a future timestamp, building a scikit-learn Pipeline and ColumnTransformer so preprocessing is fit inside the fold, training gradient boosting with xgboost, lightgbm, catboost, HistGradientBoostingClassifier or a linear/logistic baseline with statsmodels, choosing metrics with accuracy_score, roc_auc_score, average_precision_score, precision_recall_curve, f1_score, confusion_matrix, calibrating probabilities with CalibratedClassifierCV, brier_score_loss or a reliability diagram, picking a decision threshold as a product decision, resampling with imbalanced-learn SMOTE and its calibration cost, interpreting with fe4---56# Classical machine learning standards (tabular)78Criteria verified as of **August 2026**. Re-verify on the web before committing to anything (§8).910## 1. Scope and triggers1112Applies to **building and evaluating a non-deep predictive model on structured data**: whether13a model is needed at all, splitting, leakage, validation, metrics and threshold, calibration, model14family, features, imbalance, interpretability and time series.1516Triggers: `sklearn`, `Pipeline`, `ColumnTransformer`, `train_test_split`, `StratifiedKFold`,17`GroupKFold`, `TimeSeriesSplit`, `cross_val_score`, `xgboost`, `lightgbm`, `catboost`,18`HistGradientBoostingClassifier`, `LogisticRegression`, `statsmodels`, `roc_auc_score`,19`average_precision_score`, `brier_score_loss`, `CalibratedClassifierCV`, `feature_importances_`,20`permutation_importance`, `shap`, `imblearn`/`SMOTE`, `joblib.dump`, "0.99 accuracy", "imbalanced21classes", "which threshold do I set?", "the probabilities do not add up", "leakage", "backtest",22"predict churn / default / fraud / demand".2324**Domain thesis — it orders the rest of the document**:25261. **The first question is not which model, but whether a model is needed at all.** A business rule,27 a heuristic or a SQL query solves a good part of what arrives labelled as an "ML case",28 with almost zero operational cost and auditable behaviour (§2.0).292. **In tabular data, classical ML is still the *default*** — by comparative evidence (§2.1) and30 by inference cost, training time and debuggability.313. **Data leakage is the number one cause of fake models**: excellent metrics32 in validation and useless ones in production almost always mean the model saw something33 that will not exist at prediction time.344. **A number without a baseline means nothing.** AUC 0.84 can be excellent or worse than35 always predicting the majority class; without a baseline there is no way to know which.3637**`classical-ml` is not "small deep learning"**: it is another family of models, with other38assumptions, other failure modes and another economics.3940**Not applicable**:4142- `mlops-standards` (**written — critical boundary**): **the model's lifecycle in43 production is theirs** — data and experiment versioning, registry, *feature store*,44 deployment, *train/serve skew*, drift, retraining and retirement. **Here, how the model is trained and45 evaluated before getting there.** Arbitration: "is it good and why should I believe it?" belongs46 here; "how do I promote it, watch it and roll it back?" is theirs. *Fairness* and the threshold are47 computed here; monitoring them over time is theirs.48- `deep-learning-standards` and `model-finetuning-standards` (**this same wave**): your own deep49 networks and modification of pretrained weights. The boundary is the model family, not the50 data domain: **if you are going to train a network on tabular data, the justification against51 *gradient boosting* is required here (§2.1) and the training mechanics live there.**52- `llm-app-engineering-standards`, `rag-standards`, `llm-evaluation-standards`,53 `ai-agents-standards` (**written**): everything that happens on top of a third-party LLM. Practical54 boundary: **a tabular classification with historical labels is not a job for an LLM**;55 free text without labels is not a job for this skill.56- `data-engineering-standards`, `data-governance-quality-standards`,57 `data-warehouse-modeling-standards`, `sql-standards` (**written**): the pipeline, the contract,58 the quality, the grain and the query. Here it is **required** that the training data have a59 stable definition and a reliable timestamp; producing it is theirs. **If the solution was a60 `GROUP BY`, §2.0 rules and the implementation is theirs.**61- `privacy-engineering-standards` (**personal data in the training set**: lawfulness,62 minimisation, retention, DPIA and erasure on an already-trained model — here only asking63 the question before training is required) and `ai-governance-standards` (**risk classification,64 AI Act and inventory**: a threshold that denies credit or filters candidates is a regulated decision —65 the number is computed here, acceptability is decided there).66- `analytics-bi-standards` (dashboard, not automated prediction); `python-standards`,67 `r-standards`, `julia-standards` (language and environment); `finops-standards`, `green-it-standards`68 (cost and footprint); `mlsecops-standards` (poisoning, provenance, attacks);69 `gpu-computing-standards` (the GPU as a resource); `computer-vision-standards`, `nlp-standards`,70 `multimodal-genai-standards` (applications per modality).7172## 2. Default decisions7374> Verify the latest version on the web before pinning it in a real project (§8).7576### 2.0 Is a model needed? (mandatory gate)7778| Situation | Correct solution |79|---|---|80| An expert can write the rule and it fits in 10 conditions | **Business rule**, versioned in code |81| The criterion is an aggregate or a ranking over existing data | **SQL query / view** |82| There is weak signal but the volume of decisions is low and the cost of error high | **Heuristic + human review** |83| There are no labels, or there are <1000 and they are noisy | **There is no model**: instrument and label first |84| Multivariate relationship, abundant labels, repetitive and error-tolerant decision | **Model** |8586**Hard rule**: a model introduces retraining, monitoring, drift and an explanation87surface towards the customer; if a rule obtains most of the benefit, the model must88justify the rest against that permanent cost.8990### 2.1 Tabular: classical as the default — the evidence9192- Grinsztajn, Oyallon and Varoquaux, *"Why do tree-based models still outperform deep learning on93 tabular data?"* (arXiv:2207.08815, v1 18 Jul 2022). Methodology, verbatim: *"We define a94 standard set of 45 datasets from varied domains with clear characteristics of tabular data and95 a benchmarking methodology accounting for both fitting models and finding good96 hyperparameters"*; conclusion verbatim: *"tree-based models remain state-of-the-art on97 medium-sized data (~10K samples) even without accounting for their superior speed"*. **Limit98 declared by the authors: medium size (~10K).**99- Erickson et al., *TabArena: A Living Benchmark for Machine Learning on Tabular Data*100 (arXiv:2506.16791, v1 20 Jun 2025, v4 3 Nov 2025). Verbatim: *"While gradient-boosted trees are101 still strong contenders on practical tabular datasets, we observe that deep learning methods102 have caught up under larger time budgets with ensembling. At the same time, foundation models103 excel on smaller datasets."*; and their own warning: *"some deep learning models are104 overrepresented in cross-model ensembles due to validation set overfitting"*.105106**Read this as criteria, not as a headline**: *gradient boosting* is the correct starting point in107tabular data, and the one that loses the comparison is the network **with the compute and ensembling108budget of a real project**, not that of a paper. Tabular foundation models (the TabPFN line) are109a moving front and **their strongest figures come from reports by their own authors:110they are not cited here as established** — measure on your own dataset against a tuned GBDT (§8).111112### 2.2 Toolchain113114| Piece | Choice | Verified version (Aug 2026) | Licence (read in the repo) |115|---|---|---|---|116| Base | scikit-learn | 1.9.0 (2 Jun 2026, PyPI) | BSD-3-Clause |117| General GBDT | XGBoost | 3.4.0 (4 Aug 2026, PyPI; requires Python ≥3.12) | Apache-2.0 |118| Fast GBDT / large volume | LightGBM | 4.7.0 (18 Jul 2026, PyPI) | MIT |119| GBDT with native categoricals | CatBoost | 1.2.10 (18 Feb 2026, PyPI) | Apache-2.0 (© 2017-2026 YANDEX LLC) |120| Explainability | SHAP | 0.52.0 (28 May 2026, PyPI) | MIT |121| Statistical inference / CI | statsmodels | verify | verify |122123- **The three boosting libraries are permissive and suitable for commercial use.** LightGBM is MIT, without the124 patent grant that Apache-2.0 gives (XGBoost, CatBoost): if your policy requires a *patent125 grant*, that decides it (`opensource-licensing-standards`).126- **Verified change of origin**: LightGBM is no longer published from `microsoft/LightGBM`; PyPI127 4.7.0 points to `github.com/lightgbm-org/LightGBM`, whose raw `LICENSE` keeps MIT with128 copyright by Microsoft **and** "The LightGBM developers". Update URLs, SBOM and *pins*.129- **Without a GPU and with a medium-sized dataset, `HistGradientBoostingClassifier` avoids a whole130 dependency.** Adding XGBoost/LightGBM/CatBoost is justified by measured performance, native131 categoricals or distributed training, not by habit.132133## 3. Minimum defensible workflow1341351. **Decision unit and prediction instant**: what is predicted, for whom, when and with what136 information **available at that moment**. Without this there is no correct dataset.1372. **Split the data BEFORE looking at anything**: exploration, statistics, feature selection and138 imputation are decided on the training set; the test set is separated first and is not touched (§7).1393. **Dumb baseline** (majority class, mean, "the same as yesterday", the rule in production) and140 **honest baseline** (regularised regression or a single tree, inside the `Pipeline`).1414. **Candidate model**: *gradient boosting*, with validation appropriate to the data (§4.2).1425. **Calibration and threshold** (§4.3, §4.4) and **a single evaluation on the test set**, with the baseline alongside.143144All preprocessing lives **inside** the `Pipeline`/`ColumnTransformer` that is fitted in each145fold: a `fit_transform` over the full dataset before splitting is leakage, even if it is "only"146a `StandardScaler`.147148## 4. Validation, metrics and threshold149150### 4.1 Data leakage — the three cases that produce almost every fake model151152- **Temporal leakage**: a feature that will not yet exist in production, or computed with153 information later than the prediction instant (aggregates over "the whole history", columns154 updated *in place*, tables without versioning). Symptom: unrealistic metrics and a dominant155 variable that "makes sense" after the fact.156- **Leakage from preprocessing fitted on the whole set**: scaling, imputing with the global157 mean, selecting features or encoding the *target* using the validation set too. **The *target158 encoding* is the most treacherous case: it requires out-of-fold encoding.**159- **Identifier leakage**: an `id`, hash, case number or sequential code that encodes the160 order or the class; it gives itself away as a causally meaningless variable high up in importance.161- **Detection**: if the model beats the baseline by a surprising margin, the default162 hypothesis is leakage, not talent. Reproduce it with a real temporal cut before celebrating.163164### 4.2 Validation165166| Data structure | Correct split | Forbidden |167|---|---|---|168| i.i.d., balanced classes | K-fold | — |169| i.i.d., imbalanced classes | Stratified K-fold | — |170| Several rows per entity (customer, patient, device) | `GroupKFold` / `StratifiedGroupKFold` by entity | Random split: the same entity in train and test |171| Temporal | Walk-forward validation, cut by date, `TimeSeriesSplit` | Random split: training with the future |172| Hyperparameter selection + error estimation | Nested cross-validation | Reporting the best CV as an unbiased estimate |173174**A random split is incorrect on temporal or grouped data**, and it produces175exactly the same symptom as leakage: a number that does not reproduce in production.176177### 4.3 Metrics with judgement178179- ***Accuracy* is useless with imbalanced classes**: at 1 % positives,180 always predicting "negative" gives 99 %. It is never reported on its own.181- **Precision / recall / F1**: they are chosen by the asymmetric cost of the error. F1 has no182 business meaning of its own: it is for comparing, not for justifying.183- **ROC versus precision-recall**: with scarce positives the ROC is optimistic (the false184 positive rate is diluted in a huge denominator). **With strong imbalance the precision-recall curve185 and its *average precision* rule**, with the prevalence written alongside as a baseline.186- **Calibration: what almost nobody measures and what the business needs.** If the model says 0.7,187 does it happen 70 % of the time? It is measured with the *Brier score* and a reliability diagram and corrected188 with calibration (Platt/isotonic) fitted on a separate set. Good discrimination with189 poor calibration is useless for any decision that multiplies probability by an amount.190- **Regression**: MAE/RMSE depending on whether you penalise the large error; MAPE breaks with zeros and small191 values. Report in business units alongside the baseline.192193### 4.4 The threshold is a product decision194195The model produces a probability; **the threshold turns it into an action and belongs to whoever bears196the cost of the error**, not to whoever trains it. It is set with the cost matrix (false positive ×197volume against false negative × volume) or with an operational constraint (cases reviewable per198day), it is chosen on validation, it is declared and it is versioned alongside the model. **Choosing it by looking at the199test set invalidates the error estimate** (§7).200201### 4.5 CI gates, in order of cost2022031. A test that fails if there is a `fit`/`fit_transform` outside the `Pipeline` or before the split.2042. Dataset schema: columns, types, ranges, expected nulls.2053. No-leakage: forbidden columns excluded; an alert if a variable exceeds an absurd importance206 threshold.2074. Validation metric **against the baseline**, with a threshold that breaks the build.2085. Fixed seed and the same metric across two runs.209210## 5. Data, features and imbalance211212- **Feature engineering and leakage are the same problem seen twice.** Every213 feature requires answering: does this value exist at the prediction instant, with that214 latency and computed only from the past? Focus on temporal aggregates: a closed window215 before the cut.216- **High-cardinality categoricals**: native ones in CatBoost/LightGBM or out-of-fold *target217 encoding*. `OneHotEncoder` over thousands of levels is a cost mistake.218- **Imbalance**: first ask whether it is a real problem or just low prevalence. With GBDT,219 `scale_pos_weight`/class weights and an appropriate metric (§4.3) usually suffice.220- **Synthetic resampling worsens calibration.** van den Goorbergh, van Smeden, Timmerman and221 Van Calster, JAMIA 29(9):1525-1534 (2022), doi:10.1093/jamia/ocac093. Methodology: standard and222 *ridge* logistic regression under four treatments (no correction, *undersampling*,223 *oversampling* and SMOTE), evaluated on discrimination, calibration and classification, with224 Monte Carlo simulation varying size, number of predictors and event fraction.225 Result: the corrections **damage calibration by overestimating the minority class, with no226 benefit in discrimination**. **Declared discrepancy**: the follow-up on ML algorithms227 (Carriero et al., *Statistics in Medicine*, 2025) **does not generalise it to every algorithm** (§8).228 Criteria: **SMOTE is not the default step; if you use it, measure calibration before and after.**229- **PII in the training set**: lawfulness, minimisation and retention are decided in230 `privacy-engineering-standards` **before** building the dataset.231232## 6. Interpretability and time series233234- **Explaining the model ≠ explaining the decision.** Global importance describes the model; the235 person you are denying something asks about *their* case. Two different deliverables, and the second236 is usually the legally mandatory one.237- **Importance traps**: *split*/gain importance favours high cardinality and is238 distributed arbitrarily among correlated variables; permutation importance is preferable, it239 degrades with strong correlation and **must be computed on unseen data**.240- **SHAP and its limits**: additive local attribution, with independence assumptions in its241 usual approximations and a real compute cost. **It is not a causal measure** nor does it say what would happen242 if you changed the variable: it is for debugging and explaining a case, not for arguing for an intervention.243- **When interpretability rules, a linear model is preferable**: coefficients with244 intervals and stable behaviour. In regulated domains, the AUC difference against a245 GBDT rarely compensates for losing defensibility.246- **Time series**: walk-forward validation with retraining at each cut; lags and247 rolling windows computed only from the past; seasonality and calendar as explicit248 variables; declared horizon. Mandatory baseline: *naïve* and seasonal *naïve*.249250## 7. Sustainability and prohibitions251252- Review major versions of scikit-learn and of the boosting libraries every quarter. A model serialised253 with `pickle`/`joblib` **is not portable across versions**: pin the version alongside the artifact and254 test loading it in CI. Retraining, drift and retirement: `mlops-standards`.255256**FORBIDDEN**:257258- ❌ **Evaluating on the training data** and presenting that metric as the result.259- ❌ **Choosing the threshold by looking at the test set** (or any hyperparameter).260- ❌ **Presenting metrics without a baseline** or without the prevalence of the positive class.261- ❌ **Using feature importance as causality** ("variable X causes churn").262- ❌ Fitting any transformation on the full set before splitting.263- ❌ A random split with temporal data or with several rows per entity.264- ❌ Reporting *accuracy* as the main metric under imbalance, or AUC-ROC as the only metric with265 low prevalence.266- ❌ Delivering probabilities without measuring calibration when they feed an economic decision.267- ❌ Touching the test set more than once, or "trying another idea" on it.268- ❌ Training a model when a rule, a query or a heuristic solved the case.269- ❌ *Benchmark* figures without measurement conditions: dataset, split, tuning budget270 and baseline.271272## 8. Mandatory web verification273274Before committing anything in a real project, check on the web:275276- Latest stable version and Python support of **scikit-learn, XGBoost, LightGBM, CatBoost, SHAP and277 statsmodels**; XGBoost 3.4.0 already requires Python ≥3.12. Breaking API changes before moving up a278 major version.279- **The origin and licence of each library read in the repo's raw `LICENSE`**, not in a280 summary. LightGBM changed organisation (`microsoft/` → `lightgbm-org/`).281- **State of the tabular classical-vs-deep literature**: the `tabarena.ai` scoreboard and282 publications after Nov 2025. Tabular foundation models move fast and283 **their most favourable figures come from their own authors**: demand methodology, compute284 budget and independent evaluation before citing them.285- **Declared gaps**: (a) no comparative performance figure (AUC, Elo, *leaderboard*286 positions) is pinned here — the available ones lack homogeneous measurement conditions and287 independent evaluation; (b) the version and licence of `statsmodels` and `imbalanced-learn` were not288 verified in this draft.289- **Declared discrepancy**: van den Goorbergh et al. (2022) concludes against imbalance290 corrections in logistic regression; the follow-up by Carriero et al. (2025) does not generalise it to291 every ML algorithm. Check the current status and measure calibration in your case.292293If the web contradicts this document, **the web wins** — flag the discrepancy.