Showing Posts From
Machine learning
- 17 Apr, 2026
Enterprise ML Model Selection: How to Choose Without Getting It Wrong
Model selection in an enterprise is often treated as a benchmark exercise: run a few candidates, pick the most accurate, move on. The decision is wider than that. You are also choosing what you will have to explain to a risk committee, retrain on a schedule, serve at a cost and hand over to an operations team. This article gives a way to structure that decision, with claims tied to documentation and published research. It contains no client stories, and where I give an opinion I say so. Start with the output, not the algorithm Before asking which model scores best, answer two questions.What does the model's output have to do in the system it feeds? What constraints on operation are not negotiable?The first question defines what "good" means. A model whose score drives a threshold decision needs probabilities that mean what they say. The scikit-learn documentation puts it this way: among samples given a predicted probability close to 0.8, roughly 80 percent should actually be positive. It also notes that models differ here. Logistic regression is often well calibrated by itself, while random forests show a characteristic distortion, and it explains how CalibratedClassifierCV can correct a miscalibrated model (scikit-learn calibration guide). If your downstream process uses a cut-off, calibration belongs in the evaluation, not only ranking metrics such as AUC. The second question yields hard constraints that remove whole model families before any experiment:Inference latency. A user-facing call with a tight response budget rules out large models unless you fund serving infrastructure. Explainability. If decisions about individuals need explanations, a black box needs an added explanation layer. Data residency. Where training data may be processed limits where you can train. Retraining capacity. If the data shifts and you cannot retrain often, you need a model that tolerates drift or a process that detects it.Soft constraints, such as team familiarity and tooling, shape the shortlist after the hard ones have filtered it.Complexity is a cost axis More complex models can score higher. They also cost more in four ways. These are structural points and my own judgement, not measured results.Debugging. A tree ensemble's prediction can be traced with attribution tools. For a deep network the explanations are approximations. Retraining. Longer training means a higher recurring cost if you retrain often. Serving. Larger models need more memory and compute per request. Key-person risk. A model that only one or two people can maintain is an organisational risk, not just a technical choice.So justify complexity in business terms. Illustrative scenario (not a real case): a team reports that a more complex model raises AUC by some margin. That statement is incomplete until someone converts the gain into avoided loss or saved cost and compares it with the added running cost. The model families you will mostly choose between For most structured-data problems the shortlist is gradient boosting, regularised linear models, ensembles of those, and neural networks. Time series and text have their own methods and are out of scope here. I am not claiming a share of production systems that use each, because I have no source for one. Gradient boosting For tabular data, this is a sensible default to try first. There is published support for that. Grinsztajn, Oyallon and Varoquaux benchmarked deep learning methods against tree-based models such as XGBoost and random forests on tabular data and found that tree-based models remain state of the art on medium-sized data, around 10,000 samples in their setup, even before counting their speed advantage (arXiv 2207.08815). The result is for their benchmark and, per the abstract, for medium-sized data; it is not a guarantee for your dataset. Practical properties, from the documentation: XGBoost handles missing values by learning a default branch direction at each split (XGBoost FAQ), and SHAP's TreeExplainer computes exact SHAP values quickly for supported tree ensembles, including XGBoost, LightGBM and CatBoost (SHAP documentation). Limits: gradient boosting is not the natural choice for raw images or audio, and it needs more tuning than a linear model. Linear and regularised linear models Often underused in regulated settings. The coefficients are the explanation, inference is cheap, and retraining is fast. Whether a linear model is accurate enough depends on the problem; test it as a baseline before accepting extra complexity. A baseline that comes close to the complex model is itself informative. The legal context deserves precision. GDPR Article 22 gives people the right not to be subject to a decision based solely on automated processing that has legal or similarly significant effects, with safeguards including human intervention (Article 22), and Article 15(1)(h) gives access to "meaningful information about the logic involved" (Article 15). In SCHUFA (C-634/21, 7 December 2023) the Court of Justice held that assigning a credit score can itself be an automated decision under Article 22 even when a third party makes the final choice (where that party draws strongly on the score), as summarised by noyb. I read secondary summaries, not the judgment. Together these make explainability a design constraint wherever a score drives decisions about individuals. General information, not legal advice. Ensembles Stacking and voting can add accuracy once a single model's failure modes are understood. In my view they belong at the end of the process, because they add serving and maintenance cost. Neural networks Two cases differ. For images, audio and similar unstructured inputs they are usually the natural choice. For tabular data, the evidence above says to demand a demonstrated gain before accepting the infrastructure cost.Evaluation: what a benchmark leaves out Thresholds and imbalance. Rare events such as fraud or default make AUC a poor guide to operating behaviour. The operating threshold depends on the cost of false positives against false negatives, which is a business decision. Evaluate at the threshold you will actually use. Time-ordered validation. Random splits let the model see the future. scikit-learn's TimeSeriesSplit keeps training indices before test indices and supports a gap parameter to exclude samples between them (TimeSeriesSplit). Leakage. scikit-learn defines leakage as using information that will not be available at prediction time. It inflates estimates, and the model then underperforms on new data. Its documentation shows preprocessing or feature selection done before the split producing a test accuracy of 0.76 on purely random data, where chance is 0.5, and recommends fitting transformations on training data only and using a Pipeline (common pitfalls). For enterprise tables, also check each feature's write time against the prediction moment. Label quality. Test-set labels contain errors. Northcutt et al. estimated at least 3.3 percent label errors on average across ten widely used benchmark datasets, and showed that on noisier test sets, simpler models can outrank complex ones (NeurIPS 2021). Small differences between candidates may be noise. Shadow scoring. Before a model drives decisions, score live data in the background, store predictions and compare them with outcomes. This is standard practice in my view, not something I can cite a source for. # Time-ordered cross-validation with a gap, scored on AUC rather than accuracy from sklearn.model_selection import TimeSeriesSplit, cross_val_score# X, y must be sorted by timestamp, oldest first cv = TimeSeriesSplit(n_splits=5, gap=30) # gap = rows to skip; size it to your label delay scores = cross_val_score(model, X, y, cv=cv, scoring="roc_auc") print(scores.mean(), scores.std())Explainability as a requirement Capture explainability needs at problem definition. Risk committees, affected individuals and operations teams are the usual audiences, and they need different things. Global explanations (which features matter overall) help validation. Local explanations (why this output for this case) support incident response and, where Article 22 applies, the ability to give meaningful information. Linear models provide both directly. Tree models can use TreeSHAP, as above. For neural networks, attribution methods give approximations, so agree what quality of explanation is acceptable before choosing the model. Monitoring and ownership Select with the maintenance burden in view.Performance. Track the target metric on outcomes as labels arrive. Where labels are slow, define proxy metrics and accept the lag. Input drift. Compare production inputs with training inputs. The Population Stability Index is one option. Set thresholds with your model risk function rather than copying a rule of thumb. Prediction drift. Watch outputs separately from inputs; they can point to different problems. Retraining trigger. Define in advance what metric movement starts a retrain.# Population Stability Index, binned on the training distribution's quantiles import numpy as npdef psi(expected, actual, buckets=10): edges = np.quantile(expected, np.linspace(0, 1, buckets + 1)) edges[0], edges[-1] = -np.inf, np.inf e = np.histogram(expected, bins=edges)[0] / len(expected) a = np.histogram(actual, bins=edges)[0] / len(actual) e, a = np.clip(e, 1e-4, None), np.clip(a, 1e-4, None) # avoid log(0) return float(np.sum((a - e) * np.log(a / e)))Finally, decide who owns the model after launch. A model the receiving team cannot debug or retrain without specialists carries more operational risk than a simpler one it can. A selection decision record This template is the author's own framework, not a research result. Complete it before any serious modelling and keep it with the model documentation.Section Question Example of a good answerOutput What decision does the output feed, and at what threshold? Named decision, cost of each error type written downHard constraints Latency, explainability, residency, retraining capacity Each stated as a requirement with an ownerBaseline What does a regularised linear model achieve under time-ordered validation? Number plus validation methodCandidates Which two or three families, and why these? Reasons tied to data type and constraintsComplexity case What gain over baseline, converted to business terms, against added cost? Gain and cost both quantified by the teamEvaluation Time-ordered splits, leakage review, label audit, calibration check Each item ticked with evidenceExplanation Which audiences, what form, who signs off? Method named and tested on real casesOperation Monitoring metrics, drift checks, retrain trigger, owner Runbook exists and has an ownerWhat to do nextWrite the decision record before choosing a model. Build the baseline with a regularised linear model and a gradient boosting model, both on time-ordered splits. Audit a sample of labels and review every feature's availability at prediction time. Check calibration if a threshold drives the decision. Agree the explanation method with the risk function before building it. Define monitoring and a retraining trigger before deployment, and assign an owner.SourcesGrinsztajn, Oyallon, Varoquaux, Why do tree-based models still outperform deep learning on tabular data?, arXiv, 2022 Northcutt, Athalye, Mueller, Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarks, NeurIPS 2021 scikit-learn, Probability calibration scikit-learn, TimeSeriesSplit scikit-learn, Common pitfalls and recommended practices XGBoost, FAQ SHAP, TreeExplainer GDPR, Article 22 and Article 15 (gdpr-info.eu reproduction of the regulation) noyb, CJEU landmark rulings on credit ranking, summary of Case C-634/21Related readingThe Data Quality Problem Nobody Puts in the Deck Why AI Proof of Concepts Keep Failing to Reach Production AI Operating Model: Decision Rights, Roles and Funding for Enterprises
Read full article