Prepare the data
Prepare dated sales totals and promotion plans as they were known at each forecast origin.
Forecast the next period. Make the cutoff explicit.
Sales forecasting combines historical patterns with information known before the forecast starts. Promotions, calendar effects and returns need documented handling.
Learning concept · Not a validated service
Sales forecasting combines historical patterns with information known before the forecast starts. Promotions, calendar effects and returns need documented handling.
A possible application for small business planners: Help small businesses review monthly staffing and purchasing assumptions. This extension is not delivered by the supplied starter.
Prepare dated sales totals and promotion plans as they were known at each forecast origin.
Compare seasonal-naive forecasts with a lag-feature regression model.
Backtest fixed horizons with rolling origins and report MAE, bias and seasonal failures.
Show forecast-versus-actual charts with issue dates and planner annotations.
The supplied starter generates 240 daily values with trend, seasonality and noise. It builds lagged and shifted rolling features, trains a RandomForestRegressor on earlier rows and reports MAE on the final thirty rows.
for lag in [1, 7, 14]:
series[f"lag_{lag}"] = series["value"].shift(lag)
series["rolling_7"] = series["value"].shift(1).rolling(7).mean()
series = series.dropna()
train = series.iloc[:-30]
test = series.iloc[-30:]
model = RandomForestRegressor(n_estimators=300, random_state=42)
model.fit(train[feature_cols], train["value"])
forecast = model.predict(test[feature_cols])The source has a synthetic series, not sales history or a fixed-origin multi-step sales forecast. Later test rows use actual earlier test values as lag inputs. This can represent rolling one-step prediction, but not a thirty-day forecast made at a single origin. There are no prediction intervals or real operational observations.
Proposed extension: Help small businesses review monthly staffing and purchasing assumptions.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.