M Layer v2#
Warning
Please note that the v2 modules are currently in active-development and is in beta right now, so please use this API with caution. See complete documentation for v2 API here and stable v1 documentation here.
The forecasting models in the V2 ecosystem are designed with a strict emphasis on modularity and separation of concerns. The architecture decouples algorithmic logic from data processing, ensuring that models act as pure, data-agnostic PyTorch Lightning instances.
Available Models#
Below is a summary of the forecasting models currently implemented and supported in the new API.
Name |
Compatible Data Modules |
Authors |
Covariates |
Multiple targets |
Regression |
Classification |
Probabilistic |
Prediction intervals |
Flexible History Length |
Cold Start |
Compute (1-5) |
|---|---|---|---|---|---|---|---|---|---|---|---|
PranavBhatP |
x |
x |
x |
x |
x |
2 |
|||||
fbk_dsipts, PranavBhatP |
x |
x |
x |
2 |
|||||||
phoeenniixx |
x |
x |
x |
x |
3 |
||||||
fbk_dsipts, phoeenniixx |
x |
x |
x |
3 |
|||||||
PranavBhatP |
x |
x |
x |
x |
3 |
Implementing new architectures#
Please see the Extension Templates to understand the process and design of the implementations.
Every model should inherit from a base model in _base_model_v2.
- class pytorch_forecasting.models.base._base_model_v2.BaseModel(loss: Metric, logging_metrics: list[Module] | None = None, optimizer: Optimizer | str | None = 'adam', optimizer_params: dict | None = None, lr_scheduler: str | None = None, lr_scheduler_params: dict | None = None)[source]
Base model for time series forecasting.
- Parameters:
loss (Descendants of
pytorch_forecasting.metrics.Metricclass) – Loss function to use for training.logging_metrics (Optional[List[nn.Module]], optional) – List of metrics to log during training, validation, and testing.
optimizer (Optional[Union[Optimizer, str, callable]], optional) – Optimizer to use for training. Can be a string (“adam”, “adamw”, “adagrad”, “sgd”, or any
torch.optimclass name), a callable returning an optimizer, or an instance oftorch.optim.Optimizer.optimizer_params (Optional[Dict], optional) – Parameters for the optimizer.
lr_scheduler (Optional[str], optional) – Learning rate scheduler to use. Supported values: “reduce_lr_on_plateau”, “step_lr”, “cosine_annealing”, “cosine_annealing_warm_restarts”.
lr_scheduler_params (Optional[Dict], optional) – Parameters for the learning rate scheduler.
API Reference#
See the detailed API documentation for the V2 base classes and specific model implementations below:
|
Base model for time series forecasting. |
Base class for tslib models. |
|
|
DLinear: Decomposition Linear Model for Long-Term Time Series Forecasting. |
Samformer: Unlocking the Potential of Transformers in Time Series Forecasting with Sharpness-Aware Minimization and Channel-Wise Attention. |
|
Long-term Forecasting with TiDE: Time-series Dense Encoder https://arxiv.org/abs/2304.08424 |
|
|
An implementation of TimeXer model for v2 of pytorch-forecasting. |