class_docstr: Holt Winter's Exponential Smoothing
  
  Parameters
  ----------
  endog : array_like
      The time series to model.
  trend : {"add", "mul", "additive", "multiplicative", None}, optional
      Type of trend component.
  damped_trend : bool, optional
      Should the trend component be damped.
  seasonal : {"add", "mul", "additive", "multiplicative", None}, optional
      Type of seasonal component.
  seasonal_periods : int, optional
      The number of periods in a complete seasonal cycle, e.g., 4 for
      quarterly data or 7 for daily data with a weekly cycle.
  initialization_method : str, optional
      Method for initialize the recursions. One of:
  
      * None
      * 'estimated'
      * 'heuristic'
      * 'legacy-heuristic'
      * 'known'
  
      None defaults to the pre-0.12 behavior where initial values
      are passed as part of ``fit``. If any of the other values are
      passed, then the initial values must also be set when constructing
      the model. If 'known' initialization is used, then `initial_level`
      must be passed, as well as `initial_trend` and `initial_seasonal` if
      applicable. Default is 'estimated'. "legacy-heuristic" uses the same
      values that were used in statsmodels 0.11 and earlier.
  initial_level : float, optional
      The initial level component. Required if estimation method is "known".
      If set using either "estimated" or "heuristic" this value is used.
      This allows one or more of the initial values to be set while
      deferring to the heuristic for others or estimating the unset
      parameters.
  initial_trend : float, optional
      The initial trend component. Required if estimation method is "known".
      If set using either "estimated" or "heuristic" this value is used.
      This allows one or more of the initial values to be set while
      deferring to the heuristic for others or estimating the unset
      parameters.
  initial_seasonal : array_like, optional
      The initial seasonal component. An array of length `seasonal`
      or length `seasonal - 1` (in which case the last initial value
      is computed to make the average effect zero). Only used if
      initialization is 'known'. Required if estimation method is "known".
      If set using either "estimated" or "heuristic" this value is used.
      This allows one or more of the initial values to be set while
      deferring to the heuristic for others or estimating the unset
      parameters.
  use_boxcox : {True, False, 'log', float}, optional
      Should the Box-Cox transform be applied to the data first? If 'log'
      then apply the log. If float then use the value as lambda.
  bounds : dict[str, tuple[float, float]], optional
      An dictionary containing bounds for the parameters in the model,
      excluding the initial values if estimated. The keys of the dictionary
      are the variable names, e.g., smoothing_level or initial_slope.
      The initial seasonal variables are labeled initial_seasonal.<j>
      for j=0,...,m-1 where m is the number of period in a full season.
      Use None to indicate a non-binding constraint, e.g., (0, None)
      constrains a parameter to be non-negative.
  dates : array_like of datetime, optional
      An array-like object of datetime objects. If a Pandas object is given
      for endog, it is assumed to have a DateIndex.
  freq : str, optional
      The frequency of the time-series. A Pandas offset or 'B', 'D', 'W',
      'M', 'A', or 'Q'. This is optional if dates are given.
  missing : str
      Available options are 'none', 'drop', and 'raise'. If 'none', no nan
      checking is done. If 'drop', any observations with nans are dropped.
      If 'raise', an error is raised. Default is 'none'.
  
  Notes
  -----
  This is a full implementation of the holt winters exponential smoothing as
  per [1]_. This includes all the unstable methods as well as the stable
  methods. The implementation of the library covers the functionality of the
  R library as much as possible whilst still being Pythonic.
  
  See the notebook `Exponential Smoothing
  <../examples/notebooks/generated/exponential_smoothing.html>`__
  for an overview.
  
  References
  ----------
  .. [1] Hyndman, Rob J., and George Athanasopoulos. Forecasting: principles
      and practice. OTexts, 2014.
docstr: Fit the model
  
  Parameters
  ----------
  smoothing_level : float, optional
      The alpha value of the simple exponential smoothing, if the value
      is set then this value will be used as the value.
  smoothing_trend :  float, optional
      The beta value of the Holt's trend method, if the value is
      set then this value will be used as the value.
  smoothing_seasonal : float, optional
      The gamma value of the holt winters seasonal method, if the value
      is set then this value will be used as the value.
  damping_trend : float, optional
      The phi value of the damped method, if the value is
      set then this value will be used as the value.
  optimized : bool, optional
      Estimate model parameters by maximizing the log-likelihood.
  remove_bias : bool, optional
      Remove bias from forecast values and fitted values by enforcing
      that the average residual is equal to zero.
  start_params : array_like, optional
      Starting values to used when optimizing the fit.  If not provided,
      starting values are determined using a combination of grid search
      and reasonable values based on the initial values of the data. See
      the notes for the structure of the model parameters.
  method : str, default "L-BFGS-B"
      The minimizer used. Valid options are "L-BFGS-B" , "TNC",
      "SLSQP" (default), "Powell", "trust-constr", "basinhopping" (also
      "bh") and "least_squares" (also "ls"). basinhopping tries multiple
      starting values in an attempt to find a global minimizer in
      non-convex problems, and so is slower than the others.
  minimize_kwargs : dict[str, Any]
      A dictionary of keyword arguments passed to SciPy's minimize
      function if method is one of "L-BFGS-B", "TNC",
      "SLSQP", "Powell", or "trust-constr", or SciPy's basinhopping
      or least_squares functions. The valid keywords are optimizer
      specific. Consult SciPy's documentation for the full set of
      options.
  use_brute : bool, optional
      Search for good starting values using a brute force (grid)
      optimizer. If False, a naive set of starting values is used.
  use_boxcox : {True, False, 'log', float}, optional
      Should the Box-Cox transform be applied to the data first? If 'log'
      then apply the log. If float then use the value as lambda.
  
      .. deprecated:: 0.12
  
         Set use_boxcox when constructing the model
  
  use_basinhopping : bool, optional
      Deprecated. Using Basin Hopping optimizer to find optimal values.
      Use ``method`` instead.
  
      .. deprecated:: 0.12
  
         Use ``method`` instead.
  
  initial_level : float, optional
      Value to use when initializing the fitted level.
  
      .. deprecated:: 0.12
  
         Set initial_level when constructing the model
  
  initial_trend : float, optional
      Value to use when initializing the fitted trend.
  
      .. deprecated:: 0.12
  
         Set initial_trend when constructing the model
         or set initialization_method.
  
  Returns
  -------
  HoltWintersResults
      See statsmodels.tsa.holtwinters.HoltWintersResults.
  
  Notes
  -----
  This is a full implementation of the holt winters exponential smoothing
  as per [1]. This includes all the unstable methods as well as the
  stable methods. The implementation of the library covers the
  functionality of the R library as much as possible whilst still
  being Pythonic.
  
  The parameters are ordered
  
  [alpha, beta, gamma, initial_level, initial_trend, phi]
  
  which are then followed by m seasonal values if the model contains
  a seasonal smoother. Any parameter not relevant for the model is
  omitted. For example, a model that has a level and a seasonal
  component, but no trend and is not damped, would have starting
  values
  
  [alpha, gamma, initial_level, s0, s1, ..., s<m-1>]
  
  where sj is the initial value for seasonal component j.
  
  References
  ----------
  [1] Hyndman, Rob J., and George Athanasopoulos. Forecasting: principles
      and practice. OTexts, 2014.
docstr_tok: ["Fit","the","model","Parameters","--","--","--","--","--","smoothing_level",":","float",",","optional","The","alpha","value","of","the","simple","exponential","smoothing",",","if","the","value","is","set","then","this","value","will","be","used","as","the","value",".","smoothing_trend",":","float",",","optional","The","beta","value","of","the","Holt","'s","trend","method",",","if","the","value","is","set","then","this","value","will","be","used","as","the","value",".","smoothing_seasonal",":","float",",","optional","The","gamma","value","of","the","holt","winters","seasonal","method",",","if","the","value","is","set","then","this","value","will","be","used","as","the","value",".","damping_trend",":","float",",","optional","The","phi","value","of","the","damped","method",",","if","the","value","is","set","then","this","value","will","be","used","as","the","value",".","optimized",":","bool",",","optional","Estimate","model","parameters","by","maximizing","the","log-likelihood",".","remove_bias",":","bool",",","optional","Remove","bias","from","forecast","values","and","fitted","values","by","enforcing","that","the","average","residual","is","equal","to","zero",".","start_params",":","array_like",",","optional","Starting","values","to","used","when","optimizing","the","fit",".","If","not","provided",",","starting","values","are","determined","using","a","combination","of","grid","search","and","reasonable","values","based","on","the","initial","values","of","the","data",".","See","the","notes","for","the","structure","of","the","model","parameters",".","method",":","str",",","default","``","L-BFGS-B","''","The","minimizer","used",".","Valid","options","are","``","L-BFGS-B","''",",","``","TNC","''",",","``","SLSQP","''","(","default",")",",","``","Powell","''",",","``","trust-constr","''",",","``","basinhopping","''","(","also","``","bh","''",")","and","``","least_squares","''","(","also","``","ls","''",")",".","basinhopping","tries","multiple","starting","values","in","an","attempt","to","find","a","global","minimizer","in","non-convex","problems",",","and","so","is","slower","than","the","others",".","minimize_kwargs",":","dict","[","str",",","Any","]","A","dictionary","of","keyword","arguments","passed","to","SciPy","'s","minimize","function","if","method","is","one","of","``","L-BFGS-B","''",",","``","TNC","''",",","``","SLSQP","''",",","``","Powell","''",",","or","``","trust-constr","''",",","or","SciPy","'s","basinhopping","or","least_squares","functions",".","The","valid","keywords","are","optimizer","specific",".","Consult","SciPy","'s","documentation","for","the","full","set","of","options",".","use_brute",":","bool",",","optional","Search","for","good","starting","values","using","a","brute","force","(","grid",")","optimizer",".","If","False",",","a","naive","set","of","starting","values","is","used",".","use_boxcox",":","{","True",",","False",",","'log","'",",","float","}",",","optional","Should","the","Box-Cox","transform","be","applied","to","the","data","first","?","If","'log'","then","apply","the","log",".","If","float","then","use","the","value","as","lambda",".","..","deprecated",":",":","0.12","Set","use_boxcox","when","constructing","the","model","use_basinhopping",":","bool",",","optional","Deprecated",".","Using","Basin","Hopping","optimizer","to","find","optimal","values",".","Use","``","method","``","instead",".","..","deprecated",":",":","0.12","Use","``","method","``","instead",".","initial_level",":","float",",","optional","Value","to","use","when","initializing","the","fitted","level",".","..","deprecated",":",":","0.12","Set","initial_level","when","constructing","the","model","initial_trend",":","float",",","optional","Value","to","use","when","initializing","the","fitted","trend",".","..","deprecated",":",":","0.12","Set","initial_trend","when","constructing","the","model","or","set","initialization_method",".","Returns","--","--","--","-","HoltWintersResults","See","statsmodels.tsa.holtwinters.HoltWintersResults",".","Notes","--","--","-","This","is","a","full","implementation","of","the","holt","winters","exponential","smoothing","as","per","[","1","]",".","This","includes","all","the","unstable","methods","as","well","as","the","stable","methods",".","The","implementation","of","the","library","covers","the","functionality","of","the","R","library","as","much","as","possible","whilst","still","being","Pythonic",".","The","parameters","are","ordered","[","alpha",",","beta",",","gamma",",","initial_level",",","initial_trend",",","phi","]","which","are","then","followed","by","m","seasonal","values","if","the","model","contains","a","seasonal","smoother",".","Any","parameter","not","relevant","for","the","model","is","omitted",".","For","example",",","a","model","that","has","a","level","and","a","seasonal","component",",","but","no","trend","and","is","not","damped",",","would","have","starting","values","[","alpha",",","gamma",",","initial_level",",","s0",",","s1",",","...",",","s","<","m-1",">","]","where","sj","is","the","initial","value","for","seasonal","component","j.","References","--","--","--","--","--","[","1","]","Hyndman",",","Rob","J.",",","and","George","Athanasopoulos",".","Forecasting",":","principles","and","practice",".","OTexts",",","2014","."]
code: def fit(
      self,
      smoothing_level=None,
      smoothing_trend=None,
      smoothing_seasonal=None,
      damping_trend=None,
      *,
      optimized=True,
      remove_bias=False,
      start_params=None,
      method=None,
      minimize_kwargs=None,
      use_brute=True,
      use_boxcox=None,
      use_basinhopping=None,
      initial_level=None,
      initial_trend=None,
  ):
      """
      Fit the model
  
      Parameters
      ----------
      smoothing_level : float, optional
          The alpha value of the simple exponential smoothing, if the value
          is set then this value will be used as the value.
      smoothing_trend :  float, optional
          The beta value of the Holt's trend method, if the value is
          set then this value will be used as the value.
      smoothing_seasonal : float, optional
          The gamma value of the holt winters seasonal method, if the value
          is set then this value will be used as the value.
      damping_trend : float, optional
          The phi value of the damped method, if the value is
          set then this value will be used as the value.
      optimized : bool, optional
          Estimate model parameters by maximizing the log-likelihood.
      remove_bias : bool, optional
          Remove bias from forecast values and fitted values by enforcing
          that the average residual is equal to zero.
      start_params : array_like, optional
          Starting values to used when optimizing the fit.  If not provided,
          starting values are determined using a combination of grid search
          and reasonable values based on the initial values of the data. See
          the notes for the structure of the model parameters.
      method : str, default "L-BFGS-B"
          The minimizer used. Valid options are "L-BFGS-B" , "TNC",
          "SLSQP" (default), "Powell", "trust-constr", "basinhopping" (also
          "bh") and "least_squares" (also "ls"). basinhopping tries multiple
          starting values in an attempt to find a global minimizer in
          non-convex problems, and so is slower than the others.
      minimize_kwargs : dict[str, Any]
          A dictionary of keyword arguments passed to SciPy's minimize
          function if method is one of "L-BFGS-B", "TNC",
          "SLSQP", "Powell", or "trust-constr", or SciPy's basinhopping
          or least_squares functions. The valid keywords are optimizer
          specific. Consult SciPy's documentation for the full set of
          options.
      use_brute : bool, optional
          Search for good starting values using a brute force (grid)
          optimizer. If False, a naive set of starting values is used.
      use_boxcox : {True, False, 'log', float}, optional
          Should the Box-Cox transform be applied to the data first? If 'log'
          then apply the log. If float then use the value as lambda.
  
          .. deprecated:: 0.12
  
             Set use_boxcox when constructing the model
  
      use_basinhopping : bool, optional
          Deprecated. Using Basin Hopping optimizer to find optimal values.
          Use ``method`` instead.
  
          .. deprecated:: 0.12
  
             Use ``method`` instead.
  
      initial_level : float, optional
          Value to use when initializing the fitted level.
  
          .. deprecated:: 0.12
  
             Set initial_level when constructing the model
  
      initial_trend : float, optional
          Value to use when initializing the fitted trend.
  
          .. deprecated:: 0.12
  
             Set initial_trend when constructing the model
             or set initialization_method.
  
      Returns
      -------
      HoltWintersResults
          See statsmodels.tsa.holtwinters.HoltWintersResults.
  
      Notes
      -----
      This is a full implementation of the holt winters exponential smoothing
      as per [1]. This includes all the unstable methods as well as the
      stable methods. The implementation of the library covers the
      functionality of the R library as much as possible whilst still
      being Pythonic.
  
      The parameters are ordered
  
      [alpha, beta, gamma, initial_level, initial_trend, phi]
  
      which are then followed by m seasonal values if the model contains
      a seasonal smoother. Any parameter not relevant for the model is
      omitted. For example, a model that has a level and a seasonal
      component, but no trend and is not damped, would have starting
      values
  
      [alpha, gamma, initial_level, s0, s1, ..., s<m-1>]
  
      where sj is the initial value for seasonal component j.
  
      References
      ----------
      [1] Hyndman, Rob J., and George Athanasopoulos. Forecasting: principles
          and practice. OTexts, 2014.
      """
      # Variable renames to alpha,beta, etc as this helps with following the
      # mathematical notation in general
      alpha = float_like(smoothing_level, "smoothing_level", True)
      beta = float_like(smoothing_trend, "smoothing_trend", True)
      gamma = float_like(smoothing_seasonal, "smoothing_seasonal", True)
      phi = float_like(damping_trend, "damping_trend", True)
      initial_level = float_like(initial_level, "initial_level", True)
      initial_trend = float_like(initial_trend, "initial_trend", True)
      start_params = array_like(
          start_params, "start_params", optional=True
      )
      minimize_kwargs = dict_like(
          minimize_kwargs, "minimize_kwargs", optional=True
      )
      minimize_kwargs = (
          {} if minimize_kwargs is None else minimize_kwargs
      )
      use_basinhopping = bool_like(
          use_basinhopping, "use_basinhopping", optional=True
      )
      supported_methods = ("basinhopping", "bh")
      supported_methods += ("least_squares", "ls")
      supported_methods += (
          "L-BFGS-B",
          "TNC",
          "SLSQP",
          "Powell",
          "trust-constr",
      )
      method = string_like(
          method,
          "method",
          options=supported_methods,
          lower=False,
          optional=True,
      )
      # TODO: Deprecate initial_level and related parameters from fit
      if initial_level is not None or initial_trend is not None:
          raise ValueError(
              "Initial values were set during model construction. These "
              "cannot be changed during fit."
          )
      if use_boxcox is not None:
          raise ValueError(
              "use_boxcox was set at model initialization and cannot "
              "be changed"
          )
      elif self._use_boxcox is None:
          use_boxcox = False
      else:
          use_boxcox = self._use_boxcox
  
      if use_basinhopping is not None:
          raise ValueError(
              "use_basinhopping is deprecated. Set optimization method "
              "using 'method'."
          )
  
      data = self._data
      damped = self.damped_trend
      phi = phi if damped else 1.0
      if self._use_boxcox is None:
          if use_boxcox == "log":
              lamda = 0.0
              y = boxcox(data, lamda)
          elif isinstance(use_boxcox, float):
              lamda = use_boxcox
              y = boxcox(data, lamda)
          elif use_boxcox:
              y, lamda = boxcox(data)
              # use_boxcox = lamda
          else:
              y = data.squeeze()
      else:
          y = self._y
  
      self._y = y
      res = _OptConfig()
      res.alpha = alpha
      res.beta = beta
      res.phi = phi
      res.gamma = gamma
      res.level = initial_level
      res.trend = initial_trend
      res.seasonal = None
      res.y = y
      res.params = start_params
      res.mle_retvals = res.mask = None
      method = "SLSQP" if method is None else method
      if optimized:
          res = self._optimize_parameters(
              res, use_brute, method, minimize_kwargs
          )
      else:
          l0, b0, s0 = self.initial_values(
              initial_level=initial_level, initial_trend=initial_trend
          )
          res.level = l0
          res.trend = b0
          res.seasonal = s0
          if self._fixed_parameters:
              fp = self._fixed_parameters
              res.alpha = fp.get("smoothing_level", res.alpha)
              res.beta = fp.get("smoothing_trend", res.beta)
              res.gamma = fp.get("smoothing_seasonal", res.gamma)
              res.phi = fp.get("damping_trend", res.phi)
              res.level = fp.get("initial_level", res.level)
              res.trend = fp.get("initial_trend", res.trend)
              res.seasonal = fp.get("initial_seasonal", res.seasonal)
  
      hwfit = self._predict(
          h=0,
          smoothing_level=res.alpha,
          smoothing_trend=res.beta,
          smoothing_seasonal=res.gamma,
          damping_trend=res.phi,
          initial_level=res.level,
          initial_trend=res.trend,
          initial_seasons=res.seasonal,
          use_boxcox=use_boxcox,
          remove_bias=remove_bias,
          is_optimized=res.mask,
      )
      hwfit._results.mle_retvals = res.mle_retvals
      return hwfit
  
imports: from statsmodels.compat.pandas import deprecate_kwarg
  import contextlib
  from typing import Any
  from collections.abc import Hashable, Sequence
  import warnings
  import numpy
  import pandas
  from scipy.optimize import basinhopping, least_squares, minimize
  from scipy.special import inv_boxcox
  from scipy.stats import boxcox
  from statsmodels.tools.validation import array_like, bool_like, dict_like, float_like, int_like, string_like
  from statsmodels.tsa.base.tsa_model import TimeSeriesModel
  from statsmodels.tsa.exponential_smoothing.ets import _initialization_heuristic, _initialization_simple
  from statsmodels.tsa.holtwinters import _exponential_smoothers, _smoothers
  from statsmodels.tsa.holtwinters._exponential_smoothers import HoltWintersArgs
  from statsmodels.tsa.holtwinters._smoothers import to_restricted, to_unrestricted
  from statsmodels.tsa.holtwinters.results import HoltWintersResults, HoltWintersResultsWrapper
  from statsmodels.tsa.tsatools import freq_to_period
label_desc: Use image node_id 20 for calling the ExponentialSmoothing obj's underlying member method code with example usage: obj.fit(smoothing_level, smoothing_trend, smoothing_seasonal, damping_trend) and returns: hwfit