SparseTSF
Description
This API calls the SparseTSF model, which can be used for time series forecasting.
SparseTSF Model Architecture

SparseTSF is lightweight model for Long-term Time Series Forecasting.
Learning Process:
-
Data Input
- The model receives the time series data as input.
-
Down Sampling
- The data is divided into smaller chunks based on predefined periods.
-
Cross-Period Sparse Forecasting
- Predictions are made for each of the divided periods independently.
-
Up Sampling
- The individual period predictions are merged to produce the final forecasting result.
Key Features of SparseTSF:
- Cross-Period Sparse Forecasting
- A method that downsamples the original time series data into regular periods to separate seasonality and trends.
- This approach significantly reduces model complexity and the number of parameters.
- It is an optimization technique specifically designed for long-term forecasting.
API module path
from api.v2.model.SparseTSF import SparseTSF
Parameters
enc_in
- Specifies the input feature size.
- Example
- If data's shape (x,x,1).
- enc_in = 1
seq_len
- Specifies the length of the input sequence.
- Example
- If data's shape (x,10,x).
- seq_len = 10
pred_len
- Specifies the prediction length.
- Example
- pred_len = 1
period_len
- Specifies the length of the sub-sequence.
- This value cannot exceed the seq_len.
- Example
- period_len = 1
d_model
- Specifies the hidden dim size.
- This value sets the number of nodes in the intermediate layer.
- Example
- This value is typically set as a power of 2.
- d_model = 128
model_type
- Specifies the forecasting model.
- Option
- 'linear'
- 'mlp'
- consist of Linear layer
- Example
- model_type = 'mlp'
Use_revin
- Specifies whether to use RevIN normalization.
- default : False
- Example
- Use_revin = False
Example Sample Code (Python)
Results

Check the entire module code.
datahub/api/v2/model/SparseTSF.py at main · machbase/datahub
All Industrial IoT DataHub with data visualization and AI source - machbase/datahub