Construct a time-aware dataset
Ensure stable timestamps, create lag and rolling features, and encode calendar indicators without leaking future information.
Apply transformers to time series. Inspect forecast errors.
Transformers applied to time series use self-attention to model temporal dependencies and interactions across multiple contexts. Practical issues include irregular timestamps, missing values, target leakage from improper feature creation, and producing calibrated prediction intervals rather than single-point forecasts.
Learning concept · Not a validated service
Transformers applied to time series use self-attention to model temporal dependencies and interactions across multiple contexts. Practical issues include irregular timestamps, missing values, target leakage from improper feature creation, and producing calibrated prediction intervals rather than single-point forecasts.
A proposed application: a short-term demand forecast service that provides daily point forecasts and uncertainty bands to operations teams; human operators should review alerts before operational decisions are made. This extension is not delivered by the supplied starter code.
Ensure stable timestamps, create lag and rolling features, and encode calendar indicators without leaking future information.
Replace the baseline with a transformer encoder/decoder that consumes positional encodings and multi-step context windows.
Use rolling-origin evaluation so each validation fold simulates forecasting from past to future and report MAE, RMSE and coverage.
Schedule retraining, expose forecasts via an API, and add drift and input-quality monitoring.
The supplied starter generates a synthetic daily series with trend, seasonality and noise, constructs lag and a rolling mean feature, trains a RandomForestRegressor on those features, and prints MAE and a few forecast rows. It does not implement any transformer architecture.
model = RandomForestRegressor(n_estimators=300, random_state=42)
model.fit(train[feature_cols], train["value"])
forecast = model.predict(test[feature_cols])
The code fits a RandomForestRegressor on lag and rolling features and contains no transformer model, no positional encodings, and no transformer-specific training logic or architecture. It also uses a single contiguous train/test split rather than walk-forward validation and relies on synthetic data.
Proposed extension: swap the RandomForest baseline for a time-series transformer that takes windows of past values plus positional encodings, and produce multi-step forecasts with prediction intervals.
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.