DartsRegressionModel
Darts Regression Model Estimator.
Quickstart
from sktime.forecasting.darts import DartsRegressionModel
estimator = DartsRegressionModel(lags: int | list [int ] | dict [str, int | list [int ] ] | None=None, lags_past_covariates: int | list [int ] | dict [str, int | list [int ] ] | None=None, lags_future_covariates: tuple [int, int ] | list [int ] | dict [str, tuple [int, int ] | list [int ] ] | None=None, output_chunk_length: int | None=1, output_chunk_shift: int | None=0, add_encoders: dict | None=None, model=None, multi_models: bool | None=True, use_static_covariates: bool | None=True, past_covariates: list [str ] | None=None, num_samples: int | None=1000)Parameters(11)
- lagsOne of int, list, dict, default=None
- Lagged target values used to predict the next time step. If an integer is given the last lags past lags are used (from -1 backward). Otherwise a list of integers with lags is required (each lag must be < 0). If a dictionary is given, keys correspond to the component names (of first series when using multiple series) and the values correspond to the component lags(integer or list of integers).
- lags_past_covariatesOne of int, list, dict, default=None
- Number of lagged past_covariates values used to predict the next time step. If an integer is given the last lags_past_covariates past lags are used (inclusive, starting from lag -1). Otherwise a list of integers with lags < 0 is required. If a dictionary is given, keys correspond to the past_covariates component names(of first series when using multiple series) and the values correspond to the component lags(integer or list of integers).
- lags_future_covariatesOne of tuple, list, dict, default=None
- Number of lagged future_covariates values used to predict the next time step. If a tuple (past, future) is given the last past lags in the past are used (inclusive, starting from lag -1) along with the first future future lags (starting from 0 - the prediction time - up to future - 1 included). Otherwise a list of integers with lags is required. If dictionary is given, keys correspond to the future_covariates component names (of first series when using multiple series) and the values correspond to the component lags(integer or list of integers).
- output_chunk_shiftint, default=0
- Optionally, the number of steps to shift the start of the output chunk into the future (relative to the input chunk end). This will create a gap between the input (history of target and past covariates) and output. If the model supports future_covariates, the lags_future_covariates are relative to the first step in the shifted output chunk. Predictions will start output_chunk_shift steps after the end of the target series. If output_chunk_shift is set, the model cannot generate autoregressive predictions (n > output_chunk_length).
- output_chunk_lengthint, default=1
- Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast horizon n used in predict(). However, setting output_chunk_length equal to the forecast horizon may be useful if the covariates don’t extend far enough into the future.
- add_encodersdict, default=None
A large number of past and future covariates can be automatically generated with add_encoders. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that will be used as index encoders. Additionally, a transformer such as Darts’
add_encoders={ 'cyclic': {'future': ['month']}, 'datetime_attribute': {'future': ['hour', 'dayofweek']}, 'position': {'past': ['relative'], 'future': ['relative']}, 'custom': {'past': [lambda idx: (idx.year - 1950) / 50]}, 'transformer': Scaler() }Scalercan be added to transform the generated covariates. This happens all under one hood and only needs to be specified at model creation. ReadSequentialEncoderto find out more aboutadd_encoders. Default:None. An example showing some ofadd_encodersfeatures:- model: object, default=None
Scikit-learn-like model with
fit()andpredict()methods. Also possible to use model that doesn’t support multi-output regression for multivariate timeseries, in which case one regressor will be used per component in the multivariate series. If None, defaults to:sklearn.linear_model.LinearRegression(n_jobs=-1).- multi_modelsbool, default=True
- If True, a separate model will be trained for each future lag to predict. If False, a single model is trained to predict at step ‘output_chunk_length’ in the future. Default: True.
- use_static_covariatesbool, default=True
Whether the model should use static covariate information in case the input series passed to
fit()contain static covariates. IfTrue, and static covariates are available at fitting time, will enforce that all target series have the same static covariate dimensionality infit()andpredict().- past_covariateslist, default=None
column names in
Xwhich are known only for historical data, by default None- num_samplesint, default=1000
- Number of times a prediction is sampled from a probabilistic model, by default 1000