docstr: ARIMA
  ARIMA-type models extensible with exogenous variables (future covariates)
  and seasonal components.
  
  Parameters
  ----------
  p : int
      Order (number of time lags) of the autoregressive model (AR).
  d : int
      The order of differentiation; i.e., the number of times the data
      have had past values subtracted (I).
  q : int
      The size of the moving average window (MA).
  seasonal_order: Tuple[int, int, int, int]
      The (P,D,Q,s) order of the seasonal component for the AR parameters,
      differences, MA parameters and periodicity.
  trend: str
      Parameter controlling the deterministic trend. 'n' indicates no trend,
      'c' a constant term, 't' linear trend in time, and 'ct' includes both.
      Default is 'c' for models without integration, and no trend for models with integration.
  add_encoders
      A large number of 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' :class:`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 :meth:`SequentialEncoder <darts.dataprocessing.encoders.SequentialEncoder>` to find out more about
      ``add_encoders``. Default: ``None``. An example showing some of ``add_encoders`` features:
  
      .. highlight:: python
      .. code-block:: python
  
          def encode_year(idx):
              return (idx.year - 1950) / 50
  
          add_encoders={
              'cyclic': {'future': ['month']},
              'datetime_attribute': {'future': ['hour', 'dayofweek']},
              'position': {'future': ['relative']},
              'custom': {'future': [encode_year]},
              'transformer': Scaler(),
              'tz': 'CET'
          }
      ..
  
  Examples
  --------
  >>> from darts.datasets import AirPassengersDataset
  >>> from darts.models import ARIMA
  >>> from darts.utils.timeseries_generation import datetime_attribute_timeseries
  >>> series = AirPassengersDataset().load()
  >>> # optionally, use some future covariates; e.g. the value of the month encoded as a sine and cosine series
  >>> future_cov = datetime_attribute_timeseries(series, "month", cyclic=True, add_length=6)
  >>> # define ARIMA parameters
  >>> model = ARIMA(p=12, d=1, q=2)
  >>> model.fit(series, future_covariates=future_cov)
  >>> pred = model.predict(6, future_covariates=future_cov)
  >>> pred.values()
  array([[451.36489334],
         [416.88972829],
         [443.10520391],
         [481.07892911],
         [502.11286509],
         [555.50153984]])
docstr_tok: ["ARIMA","ARIMA-type","models","extensible","with","exogenous","variables","(","future","covariates",")","and","seasonal","components",".","Parameters","--","--","--","--","--","p",":","int","Order","(","number","of","time","lags",")","of","the","autoregressive","model","(","AR",")",".","d",":","int","The","order","of","differentiation",";","i.e.",",","the","number","of","times","the","data","have","had","past","values","subtracted","(","I",")",".","q",":","int","The","size","of","the","moving","average","window","(","MA",")",".","seasonal_order",":","Tuple","[","int",",","int",",","int",",","int","]","The","(","P",",","D",",","Q",",","s",")","order","of","the","seasonal","component","for","the","AR","parameters",",","differences",",","MA","parameters","and","periodicity",".","trend",":","str","Parameter","controlling","the","deterministic","trend",".","'n","'","indicates","no","trend",",","'","c","'","a","constant","term",",","'t","'","linear","trend","in","time",",","and","'ct","'","includes","both",".","Default","is","'","c","'","for","models","without","integration",",","and","no","trend","for","models","with","integration",".","add_encoders","A","large","number","of","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","'",":","class",":","`","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",":","meth",":","`","SequentialEncoder","<","darts.dataprocessing.encoders.SequentialEncoder",">","`","to","find","out","more","about","``","add_encoders","``",".","Default",":","``","None","``",".","An","example","showing","some","of","``","add_encoders","``","features",":","..","highlight",":",":","python","..","code-block",":",":","python","def","encode_year","(","idx",")",":","return","(","idx.year","-","1950",")","\/","50","add_encoders=","{","'cyclic","'",":","{","'future","'",":","[","'month","'","]","}",",","'datetime_attribute","'",":","{","'future","'",":","[","'hour","'",",","'dayofweek","'","]","}",",","'position","'",":","{","'future","'",":","[","'relative","'","]","}",",","'custom","'",":","{","'future","'",":","[","encode_year","]","}",",","'transformer","'",":","Scaler","(",")",",","'tz","'",":","'CET'","}","..","Examples","--","--","--","--",">",">",">","from","darts.datasets","import","AirPassengersDataset",">",">",">","from","darts.models","import","ARIMA",">",">",">","from","darts.utils.timeseries_generation","import","datetime_attribute_timeseries",">",">",">","series","=","AirPassengersDataset","(",")",".load","(",")",">",">",">","#","optionally",",","use","some","future","covariates",";","e.g",".","the","value","of","the","month","encoded","as","a","sine","and","cosine","series",">",">",">","future_cov","=","datetime_attribute_timeseries","(","series",",","``","month","''",",","cyclic=True",",","add_length=6",")",">",">",">","#","define","ARIMA","parameters",">",">",">","model","=","ARIMA","(","p=12",",","d=1",",","q=2",")",">",">",">","model.fit","(","series",",","future_covariates=future_cov",")",">",">",">","pred","=","model.predict","(","6",",","future_covariates=future_cov",")",">",">",">","pred.values","(",")","array","(","[","[","451.36489334","]",",","[","416.88972829","]",",","[","443.10520391","]",",","[","481.07892911","]",",","[","502.11286509","]",",","[","555.50153984","]","]",")"]
code: def __init__(
      self,
      p: int = 12,
      d: int = 1,
      q: int = 0,
      seasonal_order: Tuple[int, int, int, int] = (0, 0, 0, 0),
      trend: Optional[str] = None,
      random_state: Optional[int] = None,
      add_encoders: Optional[dict] = None,
  ):
      """ARIMA
      ARIMA-type models extensible with exogenous variables (future covariates)
      and seasonal components.
  
      Parameters
      ----------
      p : int
          Order (number of time lags) of the autoregressive model (AR).
      d : int
          The order of differentiation; i.e., the number of times the data
          have had past values subtracted (I).
      q : int
          The size of the moving average window (MA).
      seasonal_order: Tuple[int, int, int, int]
          The (P,D,Q,s) order of the seasonal component for the AR parameters,
          differences, MA parameters and periodicity.
      trend: str
          Parameter controlling the deterministic trend. 'n' indicates no trend,
          'c' a constant term, 't' linear trend in time, and 'ct' includes both.
          Default is 'c' for models without integration, and no trend for models with integration.
      add_encoders
          A large number of 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' :class:`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 :meth:`SequentialEncoder <darts.dataprocessing.encoders.SequentialEncoder>` to find out more about
          ``add_encoders``. Default: ``None``. An example showing some of ``add_encoders`` features:
  
          .. highlight:: python
          .. code-block:: python
  
              def encode_year(idx):
                  return (idx.year - 1950) / 50
  
              add_encoders={
                  'cyclic': {'future': ['month']},
                  'datetime_attribute': {'future': ['hour', 'dayofweek']},
                  'position': {'future': ['relative']},
                  'custom': {'future': [encode_year]},
                  'transformer': Scaler(),
                  'tz': 'CET'
              }
          ..
  
      Examples
      --------
      >>> from darts.datasets import AirPassengersDataset
      >>> from darts.models import ARIMA
      >>> from darts.utils.timeseries_generation import datetime_attribute_timeseries
      >>> series = AirPassengersDataset().load()
      >>> # optionally, use some future covariates; e.g. the value of the month encoded as a sine and cosine series
      >>> future_cov = datetime_attribute_timeseries(series, "month", cyclic=True, add_length=6)
      >>> # define ARIMA parameters
      >>> model = ARIMA(p=12, d=1, q=2)
      >>> model.fit(series, future_covariates=future_cov)
      >>> pred = model.predict(6, future_covariates=future_cov)
      >>> pred.values()
      array([[451.36489334],
             [416.88972829],
             [443.10520391],
             [481.07892911],
             [502.11286509],
             [555.50153984]])
      """
      super().__init__(add_encoders=add_encoders)
      self.order = p, d, q
      self.seasonal_order = seasonal_order
      self.trend = trend
      self.model = None
      if statsmodels_above_0135:
          self._random_state = (
              random_state
              if random_state is None
              else np.random.RandomState(random_state)
          )
      else:
          self._random_state = None
          np.random.seed(
              random_state if random_state is not None else 0
          )
  
file_path: darts/darts/models/forecasting/arima.py
imports: from typing import Optional, Tuple
  import numpy
  from statsmodels import __version_tuple__
  from statsmodels.tsa.arima.model import ARIMA
  from darts.logging import get_logger
  from darts.models.forecasting.forecasting_model import TransferableFutureCovariatesLocalForecastingModel
  from darts.timeseries import TimeSeries
label_desc: Use image node_id 1 to create a new ARIMA object from inherited base classes: TransferableFutureCovariatesLocalForecastingModel with example: obj = ARIMA(p, d, q, seasonal_order, trend, random_state, add_encoders)