On this page
A feature’s value depends on prediction time
Predicting delivery delay on order day is different from predicting it on delivery morning. The label may stay the same while the available information changes. A feature’s actual availability at that moment is the basis of point-in-time correctness. Whether the decision concerns an order, customer or daily total also affects splitting and error costs. Predicting the number of delay hours and predicting whether delay exceeds 24 hours require different outputs; that business question drives the classification-regression choice.
What does feature engineering add?
Useful features preserve information about the process rather than blindly multiplying columns. A 30-day customer order count can be valuable if computed at the correct cutoff. Rolling windows that include target-day or future events create leakage. Categorical encodings, cyclic time features and interactions should be tested against the task. Allowing IDs to become shortcuts may produce strong in-sample scores but poor generalization to new customers. Document each feature's definition, source, update frequency and missingness behavior.
How do pipelines reduce leakage?
Fitting scaling, imputation and category encoding on the full dataset can carry test information into training. A pipeline keeps transformations and the model together, making training-fold-only fitting easier. A future feature or the same customer appearing in two splits can still introduce leakage independently. A pipeline organises implementation; it does not replace knowledge about which records belong together or must be separated in time.
Linear models, random forests and gradient boosting
Linear or logistic regression offers a fast, interpretable baseline. Random forests can model nonlinear relationships and interactions. Gradient boosting is a strong candidate in many tabular tasks, although hyperparameters and handling of missing/categorical features vary by implementation. Compare families under the same held-out conditions. Better average scores do not guarantee operational superiority: examine latency, training cost, memory, calibration and maintenance. If complexity adds no measurable business benefit, the simpler model may be preferable.
Choosing the right cross-validation strategy
Random K-fold can be reasonable for independent, similarly distributed observations. Repeated records from the same patient, customer or machine require group-aware splits. Forecasting the future demands chronological evaluation; random mixing may leak future structure into the past. Nested CV can separate hyperparameter tuning from performance estimation. With limited data, report variation across resamples or seeds where appropriate. The split design is part of the scientific claim, not a footnote.
Metrics for imbalanced classification
If one in a thousand shipments is delayed, predicting “on time” for every order yields excellent accuracy while catching no delays. Evaluate precision, recall, PR-AUC, false alerts and economic impact per decision. ROC-AUC measures ranking but precision–recall views can better describe low-prevalence operations. Select thresholds on validation and business costs, never by tuning against the final test set. If predicted probabilities are uncalibrated, a threshold such as .7 may not have the intuitive meaning users expect.
Interpreting feature importance and SHAP
SHAP and permutation importance explain which features a model uses under the current data distribution. They do not establish the effect of intervening on those features in the real world. Correlated-feature contributions can also depend on method assumptions. Changing explanations across errors and subgroups reveal these limits. A leaked field appearing important may indicate an exploitable shortcut rather than a model finding the correct real-world reason.
Maintaining a tabular model in production
Feature schemas, missingness, novel categories, prediction distributions and latency can drift even when model weights remain unchanged. Monitor these indicators and actual performance once labels arrive. Distribution shift does not necessarily imply quality failure; some changes reflect legitimate business evolution. Do not trigger retraining on drift alarms alone. Maintain rollback versions and a reproducible validation suite. This turns tabular modeling from a notebook exercise into a sustained service.
Predicting delivery delay when an order is placed
Illustrative scenario; not a measured project result.
Imagine predicting shipment delays at order creation time. A feature such as “delivery completed” is unavailable then and must not be included. Randomly splitting near-identical orders from the same customer may also let a model memorize customer patterns. Time-aware and group-aware tests may better reflect real generalization. This is an illustrative logistics scenario.
Not every score-raising feature is useful
A field created after delivery may make historical delay predictions look excellent. If it does not exist when the order is placed, that success cannot transfer to use. Splitting one customer’s records across training and test data can create similar optimism. Model-family selection comes after these issues: without correct prediction timing and splitting, a stronger model may simply learn a stronger shortcut.
Frequently asked questions
What is the best model for tabular data?
No universal winner exists; compare baselines and ensembles on representative splits and costs.
Does SHAP establish causality?
No. It describes model contributions, not real-world intervention effects.
Does a pipeline eliminate all leakage?
No. Incorrect temporal or group splits remain a risk.