Prepare the data
Prepare dated item-level sales with availability flags and a fixed forecast horizon.
Plan for demand. Account for missing sales.
Observed sales may understate demand when products are unavailable. A useful forecast distinguishes stockouts, promotions and intermittent demand before supporting inventory planning.
Learning concept · Not a validated service
Observed sales may understate demand when products are unavailable. A useful forecast distinguishes stockouts, promotions and intermittent demand before supporting inventory planning.
A possible application for retail inventory planners: Help small retailers review replenishment assumptions for a limited item range. This extension is not delivered by the supplied starter.
Prepare dated item-level sales with availability flags and a fixed forecast horizon.
Compare lag-feature regression with seasonal-naive and intermittent-demand baselines where appropriate.
Use rolling-origin MAE and bias by item, examining stockout periods separately.
Provide planner-reviewed forecasts with horizon labels and stockout caveats.
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 uses a synthetic series without products, stockouts or replenishment constraints. 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 retailers review replenishment assumptions for a limited item range.
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.