Aligning Loss and Evaluation Metrics in Time Series
Using the same strictly consistent scoring function for both training and evaluation in time series forecasting ensures models are optimized for and accurately assessed against the desired outcome.
Practical explanations of mathematical models: overfitting, quality evaluation, result checks and limits on conclusions.
Compare a model's conclusions with the task conditions and evaluation method. Explanations and checks help you recognize overfitting and understand where results become unreliable.
Using the same strictly consistent scoring function for both training and evaluation in time series forecasting ensures models are optimized for and accurately assessed against the desired outcome.
Decide between MAE and RMSE by aligning the loss with the target functional - mean versus median - and the business tolerance for large errors. RMSE magnifies outliers while MAE keeps them linear, affecting risk‑sensitive decisions.
Align alpha with business risk, train with HistGradientBoostingRegressor loss='quantile', and evaluate using mean_pinball_loss with matching alpha in GridSearchCV.
Use validation_curve to spot over- or underfitting from a single hyperparameter; use learning_curve to judge if more data will reduce variance. This article explains how to interpret the train-validation gap and avoid common pitfalls.
Learning curves plot training and validation scores against sample size. A wide persistent gap signals variance (more data helps); a low plateau with a small gap signals bias (more data will not help).
Passing an integer to a CV splitter guarantees identical folds across estimator comparisons, while a RandomState instance causes different splits on each split() call, making fold-wise scores non-comparable.
Fit preprocessing steps like feature selection and StandardScaler only on the training split; a scikit-learn Pipeline enforces the correct fit/transform sequence and prevents optimistic scores.
scikit-learn scorers must return higher-is-better values, so error metrics are registered as neg_-prefixed strings that cross_val_score and GridSearchCV maximize. Negate the returned scores to recover the original loss.
MAE counts each prediction error linearly and without a cap: one large error shifts the metric by its magnitude divided by n. Outlier robustness means no quadratic amplification, not insensitivity to extreme errors.
Use TimeSeriesSplit to evaluate time-ordered forecasts without leakage, compute per-horizon errors, and choose a strictly consistent metric that matches the decision cost.