Class Signature
TinyTimeMixerModel class implements IBM’s TinyTimeMixer, a lightweight and efficient time series forecasting model designed for edge deployment and resource-constrained environments.
Initialization Parameters
Model configuration dictionary. Must include context_len and horizon_len.
Hugging Face model repository ID. The model automatically selects the appropriate revision based on context_len and horizon_len.
Configuration Parameters
Length of the input context window (e.g., 512).
Forecast horizon length. The model will select the closest available horizon from [96, 192, 336, 720].
Methods
finetune()
Dataset for finetuning. Call
get_data_loader() to get the dataloader.Optional keyword arguments (currently uses default hyperparameters: lr=1e-4, epochs=5).
The model is finetuned in-place.
evaluate()
Dataset for evaluation. Call
get_data_loader() to get the dataloader.If True, return only metrics.
When
metric_only=True:Dictionary containing:mse: Mean Squared Errormae: Mean Absolute Errormase: Mean Absolute Scaled Errormape: Mean Absolute Percentage Errorrmse: Root Mean Squared Errornrmse: Normalized RMSEsmape: Symmetric Mean Absolute Percentage Errormsis: Mean Scaled Interval Scorend: Normalized Deviation
metric_only=False:Tuple of (metrics, trues, preds, histories):metrics: Dictionary of metrics (as above)trues: Ground truth values, shape (num_samples, num_ts, horizon_len)preds: Predictions, shape (num_samples, num_ts, horizon_len)histories: Historical context, shape (num_samples, num_ts, context_len)
plot()
Dataset for plotting. Call
get_data_loader() to get the dataloader.Additional keyword arguments forwarded to visualization.
This method does not return a value. It displays visualizations.
Usage Example
Notes
- TinyTimeMixer is optimized for efficiency and edge deployment
- The model automatically selects the appropriate checkpoint revision based on your specified horizon_len
- Available horizon lengths are 96, 192, 336, and 720 - the model uses the closest larger value
- The default context length of 512 with horizon 96 uses the “main” revision
- Data is automatically permuted to match the expected input format (batch, channels, time)
- The model requires a repository ID - it cannot be initialized without pre-trained weights