Forecast the decision, not just the next number
A forecast can look accurate in a notebook and still be useless to the business. It may predict tomorrow when purchasing decisions need a month of lead time, use features that are unavailable at prediction time, or optimize average error while consistently underestimating the busiest periods.
This guide is for data scientists, engineers and decision makers turning time series forecasting into a repeatable production process. Start with the decision horizon, establish an honest baseline and evaluate the information that would actually have been available when each historical forecast was issued.
Key takeaways
- Define the target, horizon, update cadence and decision cost before modeling.
- Compare candidates against simple baselines on the same forecast origins.
- Use chronological validation with realistic feature availability.
- Evaluate errors by horizon and business segment, not only as one average.
- Monitor delayed outcomes and preserve a safe fallback forecast.
Define the target and its business use
Write down what is being predicted, at what frequency and for whom. Daily demand per product and weekly revenue per region are different modeling problems. Specify whether the target measures orders placed, units fulfilled or unconstrained demand. Observed sales during a stockout are not automatically a clean measure of demand.
Choose the forecast horizon from the action being supported. A staffing plan may need a weekly view with daily detail, while a replenishment decision may depend on supplier lead time. Evaluate the full horizon the business uses, because a model that is strong one step ahead may degrade substantially farther into the future.
Record the issue time and data cutoff. A forecast produced before the business day starts cannot use the day's completed transactions. If source data arrives late or is revised, store the version available at the issue time. Otherwise, a backtest can benefit from corrected history that the production system never had.
+--------------------+ +--------------------+
| Time-stamped data | --> | Availability checks|
+--------------------+ +---------+----------+
|
+---------v----------+
| Rolling backtests |
| Baseline + candidates|
+---------+----------+
|
+---------v----------+
| Forecast artifact |
| Horizon + intervals|
+---------+----------+
|
+---------v----------+
| Business decision |
+---------+----------+
|
+---------v----------+
| Delayed outcome |
| Error + recalibration|
+--------------------+
Define the cost of errors with stakeholders. Underforecasting may cause stockouts, while overforecasting may increase waste or idle capacity. Those costs can differ by product and season. A statistical loss function is useful only when its relationship to the decision is understood.
Audit the calendar and missing periods
Create a complete time index at the required frequency. Distinguish a genuine zero from a missing observation, a closed business day and an ingestion failure. Filling every missing value with zero can teach the model artificial patterns. Document how time zones, holidays and daylight-saving changes affect the target.
Establish baselines that are hard to fool
Start with a last-observation baseline and a seasonal naive baseline where seasonality is meaningful. For daily data with a weekly pattern, the seasonal baseline repeats the corresponding day from the previous week. A moving average or a simple trend model can provide additional context, but keep the first comparison easy to explain.
Baselines expose problems in the dataset and evaluation. If a complex model appears to outperform a seasonal baseline by an implausibly large margin, inspect leakage, target construction and split alignment before celebrating. If no candidate improves the baseline consistently at the required horizon, deploying the baseline may be the responsible choice.
The following runnable Python example creates a seasonal naive forecast using only observations available before the forecast origin. The values are synthetic, and the period is illustrative rather than a recommendation for every dataset.
def seasonal_naive(history, horizon, period):
if period < 1 or horizon < 1 or len(history) < period:
raise ValueError("insufficient history or invalid horizon")
season = history[-period:]
return [season[index % period] for index in range(horizon)]
history = [10, 12, 11, 14, 16, 20, 18,
11, 13, 12, 15, 17, 21, 19]
forecast = seasonal_naive(history, horizon=3, period=7)
assert forecast == [11, 13, 12]
print(forecast)
| Model family | Useful starting point | Main caution |
|---|---|---|
| Seasonal naive | Stable recurring patterns | Cannot anticipate structural change |
| Statistical time series | Trend and seasonal structure | Assumptions need checking |
| Lag-based regression | Rich known covariates | Feature leakage is easy to introduce |
| Larger neural models | Many related series or complex patterns | More data and operational complexity |
Choose candidate complexity based on evidence and constraints. A large model may be useful across many related series, but that does not remove the need for per-segment evaluation. A model that improves high-volume products can still fail on sparse or newly introduced items.
Validate through time without future information
Use chronological splits that simulate repeated forecast issue times. At each origin, fit transformations and models using only earlier eligible data, then forecast the required horizon. Move the origin forward and repeat. This exposes performance across seasons and changing conditions rather than relying on one fortunate test period.
The TimeSeriesSplit documentation describes ordered splits and a configurable gap. Its equally spaced sample assumption matters when comparing fold durations. For business forecasting, adapt the split design to the actual issue cadence, horizon and feature publication delays.
A gap can prevent near-boundary leakage, but it does not fix every availability problem. A feature may describe a past date while being published weeks later. Track both event time and availability time where relevant. Features should pass an as-of check against the forecast issue time.
This runnable Python example evaluates a seasonal baseline over expanding windows. The illustrative history is regular and complete. It reports mean absolute error across forecast points; a production evaluation should also break results down by horizon and business segment.
def rolling_mae(values, period=7, horizon=3, minimum=14):
errors = []
for origin in range(minimum, len(values) - horizon + 1):
season = values[origin - period:origin]
predicted = [season[h % period] for h in range(horizon)]
actual = values[origin:origin + horizon]
errors.extend(abs(a - p) for a, p in zip(actual, predicted))
if not errors:
raise ValueError("not enough data for a backtest")
return sum(errors) / len(errors)
values = [10, 12, 11, 14, 16, 20, 18] * 5
assert rolling_mae(values) == 0
print(rolling_mae(values))
Fit preprocessing separately within each training window. Scaling, imputation, feature selection and target encoding can all leak future information if computed on the full dataset. The same applies to selecting hyperparameters repeatedly against the final holdout period. Reserve a final evaluation window after development choices are fixed.
Check recursive and direct strategies honestly
A recursive model uses its own predictions as inputs for later steps. A direct strategy predicts a particular horizon without that recursion. Evaluate each as it will run in production. Feeding actual future values into later steps during a backtest gives a recursive model information it will not have at serving time.
Add features and uncertainty with clear limits
Separate features known in advance from features that must themselves be forecast. Calendar information may be known, while future price, promotion or weather values may not be. If the business supplies a planned promotion schedule, record that plan's version and distinguish it from what ultimately happened.
Use lagged values and rolling statistics carefully. Each feature should be computed from observations available before the target time and issue cutoff. Centered rolling windows are particularly dangerous because they include future values. A feature pipeline should make its temporal boundary explicit rather than relying on a developer to remember it.
External variables can help when they carry relevant information, but they add dependencies. Decide what happens when a source is late or unavailable. A forecast should not silently substitute an actual future value in evaluation and then use a stale placeholder in production. Test the fallback feature path as a separate scenario.
Prediction intervals express uncertainty under a modeling and calibration process. They are not guarantees for every future event. Evaluate empirical coverage and interval width over rolling windows and important segments. An interval that is very wide may cover the outcome while offering little help for the decision.
Connect forecasts to scenarios
Some business questions are conditional: what might demand look like if a planned promotion occurs? Label those outputs as scenario forecasts and record the assumed inputs. Do not present a conditional scenario as an unconditional expectation. Users need to know which assumptions they can change and which are fixed observations.
For hierarchical data, decide whether forecasts must reconcile across product, region and total levels. Independently forecasted series may not add up. Reconciliation can improve consistency, but it should be evaluated for the levels that actually drive decisions rather than applied solely to make a dashboard look tidy.
Deploy a forecast as a versioned data product
Persist each forecast with its issue time, target period, entity, model version, data cutoff and configuration. Keep the original forecast even after actual outcomes arrive. Overwriting it with a newer prediction makes honest evaluation impossible because the record no longer reflects what the business knew when it acted.
Use an explicit publication step after validating completeness and basic constraints. Check that all required entities and horizons are present, that units are correct and that prohibited outputs are handled according to policy. Negative values may be invalid for some targets, but clipping them changes the forecast distribution and should be evaluated rather than hidden.
For packaging, rollout and rollback considerations, see the machine learning deployment checklist. Forecasting adds a particular requirement: the serving artifact is often a dated table of future values, so publication and downstream consumption deserve the same attention as the model file.
Monitor data freshness immediately and forecast quality as outcomes become available. A model can serve without errors while its source data is stale. Conversely, quality cannot always be judged until the target period closes. Align alerts with those different feedback times and avoid calling an unevaluated horizon healthy simply because no error has been measured yet.
Keep a fallback and a review process
Maintain a baseline that can produce a usable forecast when the main model or a feature source fails. Record when the fallback is used and explain its limitations to consumers. The fallback should be tested on the same operational cadence, not left as an old notebook that nobody can run during an incident.
Review bias, error and interval coverage by horizon, entity class and relevant business conditions. A persistent underforecast in one segment may require target correction, a new feature or a different model. Retraining automatically is not a universal repair for a broken data feed or a changed business definition.
When users override forecasts, store the original, the override, the author and the reason. Evaluate overrides separately so the organization can learn where human information helps. Do not silently train future models on overridden values as though they were observed outcomes.
Common mistakes
- Choosing a horizon that is convenient for modeling but too short for the decision.
- Treating missing observations, closures and true zeros as the same thing.
- Fitting preprocessing on all data before chronological validation.
- Using future covariates that will not exist at forecast issue time.
- Overwriting historical forecasts and losing the ability to evaluate them honestly.
Checklist
- Define the target, decision horizon, cadence and error consequences.
- Audit calendar alignment, missingness and source availability times.
- Establish seasonal and simple baselines on identical evaluation windows.
- Run rolling backtests with preprocessing fitted inside each window.
- Evaluate horizon-specific errors, bias and interval coverage.
- Publish versioned forecasts with issue time and data cutoff.
- Test fallback behavior and monitor delayed business outcomes.
FAQ
Should time series data be split randomly?
Usually not for forecasting future periods. Random splits can allow future information to influence training and produce an unrealistic estimate of performance. Use a validation design that reproduces the actual forecast issue process.
Which accuracy metric should a business use?
Choose metrics that reflect scale and decision costs, and report more than one view when needed. Percentage errors can behave poorly around zero, so inspect the target distribution before selecting them as the primary measure.
How much history is enough?
It depends on seasonality, forecast horizon, structural changes and the model family. More history is not always better if older behavior no longer represents the current process, so compare training-window choices through backtesting.
Should the model retrain after every bad forecast?
No. First determine whether the problem came from data, a changed business process, an unusual event or model behavior. Retraining on an unresolved data problem can make the system less reliable.
Final thoughts
Business forecasting is a loop between available information, a decision and a later outcome. Honest baselines, temporal validation and preserved forecast records make that loop useful long after the notebook is closed.
For help building the process, explore my data science and machine learning service and book a conversation.


Comments
No comments yet. Start the conversation.
Leave a comment