7.9.29. Forecasting Examples Guide
In 1.4.0 this page was a generic forecasting tutorial that pointed to an examples/forecasting folder. That
folder does not exist in 1.5.0. This page is now a short guide to the forecasting examples and the settings
that matter for them. Each example has its own page with the full configuration.
7.9.29.1. Forecasting Examples in 1.5.0
All use task_type: generic_timeseries_forecasting and are run from the tinyml-modelzoo folder with
./run_tinyml_modelzoo.sh examples/<folder>/<config>.yaml (Windows: see Running Examples).
Config |
Device |
Model |
Page |
|---|---|---|---|
|
F28P55 |
|
|
|
F28P55 |
|
|
|
MSPM0G5187 |
|
|
|
F28P55 |
|
7.9.29.2. How Forecasting Works
A forecasting model reads a window of past values (frame_size time steps of variables input columns)
and predicts the next forecast_horizon steps of one or more target_variables. The SimpleWindow
transform creates the windows and is mandatory. The stride (stride_size) is a fraction of the frame size.
data_processing_feature_extraction:
data_proc_transforms:
- SimpleWindow
frame_size: 32
stride_size: 0.1
forecast_horizon: 2
variables: 1
target_variables:
- 0
Rules to remember:
The dataset needs the
files/plusannotations/layout, see Forecasting Dataset Format.output_intmust befalsein thetrainingsection.Feature extraction is not supported for forecasting.
Downsamplecan be added todata_proc_transformstogether withsampling_rateandnew_sr.target_variablesaccepts column indices (0-based after the time column), column names, a single index or name, or an empty list to predict all columns.Multi-variable forecasting works by listing several indices or names in
target_variables. Metrics are reported per variable and per predicted time step.
7.9.29.3. Metrics
SMAPE (0% to 200%, lower is better) and R2 (higher is better) are computed per target variable and per predicted
time step. The best epoch is the one with the lowest average SMAPE. A larger forecast_horizon normally lowers the
accuracy of the later time steps, which you can see in the per-time-step table of each run.
7.9.29.4. Available Models
The forecasting models enabled in tinyml_modelzoo/model_descriptions/forecasting.py are:
Model |
Description |
|---|---|
|
One LSTM layer (hidden size 8 or 10) followed by a linear layer |
|
4 fully connected layers, about 3k parameters |
|
2 Conv, BatchNorm, ReLU layers and a linear layer, about 13k parameters |
|
NPU-compliant convolutional models of about 0.5k to 20k parameters ( |
Use an _NPU model on devices with an NPU (F28P55, F28P65, MSPM0G5187) and see Model Zoo Reference.
Warning
The quantized FCST_LSTM10 model has shown a large accuracy drop in 1.5.0 runs (see
Generic Timeseries Forecasting). Always compare the float and quantized results of your own run.
7.9.29.5. Forecasting versus Regression
Aspect |
Regression |
Forecasting |
|---|---|---|
Output |
Value for the current window |
Future values ( |
Task type |
|
|
Metrics |
RMSE, R2 |
SMAPE, R2 per time step |
Examples |
Generic Timeseries Regression, Torque Measurement Regression |
Generic Timeseries Forecasting, PMSM Rotor Temperature Forecasting |