docstr: An implementation of the Theta method with configurable `theta` parameter. See [1]_.
  
  The training time series is de-seasonalized according to `seasonality_period`,
  or an inferred seasonality period.
  
  `season_mode` must be a ``SeasonalityMode`` Enum member.
  
  You can access the Enum with ``from darts.utils.utils import SeasonalityMode``.
  
  Parameters
  ----------
  theta
      Value of the theta parameter. Defaults to 2. Cannot be set to 0.
      If `theta = 1`, then the theta method restricts to a simple exponential smoothing (SES)
  seasonality_period
      User-defined seasonality period. If not set, will be tentatively inferred from the training series upon
      calling :func:`fit()`.
  season_mode
      Type of seasonality.
      Either ``SeasonalityMode.MULTIPLICATIVE``, ``SeasonalityMode.ADDITIVE`` or ``SeasonalityMode.NONE``.
      Defaults to ``SeasonalityMode.MULTIPLICATIVE``.
  
  References
  ----------
  .. [1] `Unmasking the Theta method <https://robjhyndman.com/papers/Theta.pdf`
  
  Examples
  --------
  >>> from darts.datasets import AirPassengersDataset
  >>> from darts.models import Theta
  >>> series = AirPassengersDataset().load()
  >>> # using the canonical Theta method
  >>> model = Theta(theta=2)
  >>> model.fit(series)
  >>> pred = model.predict(6)
  >>> pred.values()
  array([[442.7256909 ],
         [433.74381763],
         [494.54534585],
         [480.36937856],
         [481.06675142],
         [545.80068173]])
docstr_tok: ["An","implementation","of","the","Theta","method","with","configurable","`","theta","`","parameter",".","See","[","1","]","_",".","The","training","time","series","is","de-seasonalized","according","to","`","seasonality_period","`",",","or","an","inferred","seasonality","period",".","`","season_mode","`","must","be","a","``","SeasonalityMode","``","Enum","member",".","You","can","access","the","Enum","with","``","from","darts.utils.utils","import","SeasonalityMode","``",".","Parameters","--","--","--","--","--","theta","Value","of","the","theta","parameter",".","Defaults","to","2",".","Can","not","be","set","to","0",".","If","`","theta","=","1","`",",","then","the","theta","method","restricts","to","a","simple","exponential","smoothing","(","SES",")","seasonality_period","User-defined","seasonality","period",".","If","not","set",",","will","be","tentatively","inferred","from","the","training","series","upon","calling",":","func",":","`","fit","(",")","`",".","season_mode","Type","of","seasonality",".","Either","``","SeasonalityMode.MULTIPLICATIVE","``",",","``","SeasonalityMode.ADDITIVE","``","or","``","SeasonalityMode.NONE","``",".","Defaults","to","``","SeasonalityMode.MULTIPLICATIVE","``",".","References","--","--","--","--","--","..","[","1","]","`","Unmasking","the","Theta","method","<","https",":","\/\/robjhyndman.com\/papers\/Theta.pdf","`","Examples","--","--","--","--",">",">",">","from","darts.datasets","import","AirPassengersDataset",">",">",">","from","darts.models","import","Theta",">",">",">","series","=","AirPassengersDataset","(",")",".load","(",")",">",">",">","#","using","the","canonical","Theta","method",">",">",">","model","=","Theta","(","theta=2",")",">",">",">","model.fit","(","series",")",">",">",">","pred","=","model.predict","(","6",")",">",">",">","pred.values","(",")","array","(","[","[","442.7256909","]",",","[","433.74381763","]",",","[","494.54534585","]",",","[","480.36937856","]",",","[","481.06675142","]",",","[","545.80068173","]","]",")"]
code: def __init__(
      self,
      theta: int = 2,
      seasonality_period: Optional[int] = None,
      season_mode: SeasonalityMode = SeasonalityMode.MULTIPLICATIVE,
  ):
      """
      An implementation of the Theta method with configurable `theta` parameter. See [1]_.
  
      The training time series is de-seasonalized according to `seasonality_period`,
      or an inferred seasonality period.
  
      `season_mode` must be a ``SeasonalityMode`` Enum member.
  
      You can access the Enum with ``from darts.utils.utils import SeasonalityMode``.
  
      Parameters
      ----------
      theta
          Value of the theta parameter. Defaults to 2. Cannot be set to 0.
          If `theta = 1`, then the theta method restricts to a simple exponential smoothing (SES)
      seasonality_period
          User-defined seasonality period. If not set, will be tentatively inferred from the training series upon
          calling :func:`fit()`.
      season_mode
          Type of seasonality.
          Either ``SeasonalityMode.MULTIPLICATIVE``, ``SeasonalityMode.ADDITIVE`` or ``SeasonalityMode.NONE``.
          Defaults to ``SeasonalityMode.MULTIPLICATIVE``.
  
      References
      ----------
      .. [1] `Unmasking the Theta method <https://robjhyndman.com/papers/Theta.pdf`
  
      Examples
      --------
      >>> from darts.datasets import AirPassengersDataset
      >>> from darts.models import Theta
      >>> series = AirPassengersDataset().load()
      >>> # using the canonical Theta method
      >>> model = Theta(theta=2)
      >>> model.fit(series)
      >>> pred = model.predict(6)
      >>> pred.values()
      array([[442.7256909 ],
             [433.74381763],
             [494.54534585],
             [480.36937856],
             [481.06675142],
             [545.80068173]])
      """
  
      super().__init__()
  
      self.model = None
      self.coef = 1
      self.alpha = 1
      self.length = 0
      self.theta = theta
      self.is_seasonal = False
      self.seasonality = None
      self.seasonality_period = seasonality_period
      self.season_period = None
      self.season_mode = season_mode
  
      raise_if_not(
          season_mode in SeasonalityMode,
          f"Unknown value for season_mode: {season_mode}.",
          logger,
      )
  
      if self.theta == 0:
          raise_log(
              ValueError("The parameter theta cannot be equal to 0."),
              logger,
          )
  
imports: import math
  from typing import List, Optional
  import numpy
  import statsmodels.tsa.holtwinters
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.models.forecasting.forecasting_model import LocalForecastingModel
  from darts.timeseries import TimeSeries
  from darts.utils.statistics import check_seasonality, extract_trend_and_seasonality, remove_from_series
  from darts.utils.utils import ModelMode, SeasonalityMode, TrendMode
label_desc: Use image node_id 1 to create a new Theta object from inherited base classes: LocalForecastingModel with example: obj = Theta(theta, seasonality_period, season_mode)