Back to models
Forecaster

DartsLinearRegressionModel

Darts LinearRegression Estimator.

Quickstart

python
from sktime.forecasting.darts import DartsLinearRegressionModel

estimator = DartsLinearRegressionModel(past_covariates: list [str ] | None=None, num_samples: int | None=1000, 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, add_encoders: dict | None=None, likelihood: str | None=None, quantiles: list [float ] | None=None, random_state: int | None=None, multi_models: bool | None=True, use_static_covariates: bool | None=True, kwargs: dict | None=None)

Parameters(13)

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_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’ Scaler can be added to transform the generated covariates. This happens all under one hood and only needs to be specified at model creation. Read SequentialEncoder to find out more about add_encoders. Default: None. An example showing some of add_encoders features:

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() }
likelihoodstr, default=None
Can be set to poisson or quantile. If set, the model will be probabilistic, allowing sampling at prediction time. This will overwrite any objective parameter.
quantileslist, default=None
Fit the model to these quantiles if the likelihood is set to quantile.
random_stateint, default=None

Control the randomness in the fitting procedure and for sampling. Default: None.

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_covariates: bool, default=True

Whether the model should use static covariate information in case the input series passed to fit() contain static covariates. If True, and static covariates are available at fitting time, will enforce that all target series have the same static covariate dimensionality in fit() and predict().

past_covariateslist, default=None

column names in X which 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
kwargs

Additional keyword arguments passed to sklearn.linear_model.LinearRegression (by default), to sklearn.linear_model.PoissonRegressor if likelihood is poisson, or to sklearn.linear_model.QuantileRegressor if likelihood is quantile. Passed as a dictionary to conform to sklearn’s API. Default: None.

References

  1. [1 ] https://github.com/unit8co/darts