Moirai2Forecaster
Adapter for using MOIRAI 2.0 Forecasters.
MOIRAI 2.0 is a decoder-only universal time series foundation model that uses quantile predictions instead of distributional sampling. It outputs predictions at 9 quantile levels (0.1 through 0.9), with point forecasts taken from the median (0.5) quantile.
Quickstart
from sktime.forecasting.moirai2 import Moirai2Forecaster
estimator = Moirai2Forecaster(checkpoint_path: str, context_length=200, num_feat_dynamic_real=None, num_past_feat_dynamic_real=None, map_location=None, target_dim=2, broadcasting=False, batch_size=32, use_source_package=False)Parameters(7)
- checkpoint_pathstr
Path to the checkpoint of the model. Supported weights are available at [1].
- context_lengthint, default=200
- Length of the context window, time points the model will take as input.
- map_locationstr, default=None
- Hardware to use for the model.
- target_dimint, default=2
- Dimension of the target.
- batch_sizeint, default=32
- Number of samples in each batch of inference.
- broadcastingbool, default=False
if True, multiindex data input will be broadcasted to single series. For each single series, one copy of this forecaster will try to fit and predict on it. The broadcasting is happening inside automatically, from the outerside api perspective, the input and output are the same, only one multiindex output from
predict- use_source_packagebool, default=False
If True, the model and configuration will be loaded directly from the source package
uni2ts.models.moirai2. This is useful if you want to bypass the local version of the package or when working in an environment where the latest updates from the source package are needed. If False, the model and configuration will be loaded from the local version of package maintained in sktime. To install the source package, follow the instructions here [2].
Examples
>>> from sktime.forecasting.moirai2 import Moirai2Forecaster
>>> import pandas as pd
>>> import numpy as np
>>> forecaster = Moirai2Forecaster (
... checkpoint_path = "Salesforce/moirai-2.0-R-small"
... )
>>> y = np. random. normal (0, 1, (30, 2))
>>> index = pd. date_range ("2020-01-01", periods = 30, freq = "D")
>>> y = pd. DataFrame (y, index = index)
>>> forecaster. fit (y) Moirai2Forecaster(checkpoint_path='Salesforce/moirai-2.0-R-small')