# Buggy code
def __init__(
    self,
    error="add",
    trend=None,
    damped=False,
    seasonal=None,
    sp=None,
    initialization_method="estimated",
    initial_level=None,
    initial_trend=None,
    initial_seasonal=None,
    bounds=None,
    dates=None,
    freq=None,
    missing="none",
    start_params=None,
    maxiter=1000,
    full_output=True,
    disp=False,
    callback=None,
    return_params=False,
    auto=False,
    information_criterion="aic",
    allow_multiplicative_trend=False,
    restrict=True,
    additive_only=False,
    n_jobs=None,
    **kwargs,
):
    # Model params
    self.error = error
    self.trend = trend
    self.damped = damped
    self.seasonal = seasonal
    self.sp = sp
    self.initialization_method = initialization_method
    self.initial_level = initial_level
    self.initial_trend = initial_trend
    self.initial_seasonal = initial_seasonal
    self.bounds = bounds
    self.dates = dates
    self.freq = freq
    self.missing = missing

    # Fit params
    self.start_params = start_params
    self.maxiter = maxiter
    self.full_output = full_output
    self.disp = disp
    self.callback = callback
    self.return_params = return_params
    self.information_criterion = information_criterion
    self.auto = auto
    self.allow_multiplicative_trend = allow_multiplicative_trend
    self.restrict = restrict
    self.additive_only = additive_only
    self.n_jobs = n_jobs

    super(AutoETS, self).__init__()


# Traceback (AttributeError)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-80-03aaf6ca0732> in <module>
----> 1 hw_auto_model.fit(y_train)

~/miniconda3/lib/python3.7/site-packages/sktime/forecasting/base/_statsmodels.py in fit(self, y_train, fh, X_train)
39         self._set_y_X(y_train, X_train)
40         self._set_fh(fh)
---> 41         self._fit_forecaster(y_train, X_train=X_train)
42         self._is_fitted = True
43         return self

~/miniconda3/lib/python3.7/site-packages/sktime/forecasting/ets.py in _fit_forecaster(self, y, X_train)
287                 delayed(_fit)(error, trend, seasonal, damped)
288                 for error, trend, seasonal, damped in _iter(
--> 289                     error_range, trend_range, seasonal_range, damped_range
290                 )
291             )

~/miniconda3/lib/python3.7/site-packages/joblib/parallel.py in __call__(self, iterable)
1027             # remaining jobs.
1028             self._iterating = False
-> 1029             if self.dispatch_one_batch(iterator):
1030                 self._iterating = self._original_iterator is not None
1031

~/miniconda3/lib/python3.7/site-packages/joblib/parallel.py in dispatch_one_batch(self, iterator)
845                 return False
846             else:
--> 847                 self._dispatch(tasks)
848                 return True
849

~/miniconda3/lib/python3.7/site-packages/joblib/parallel.py in _dispatch(self, batch)
763         with self._lock:
764             job_idx = len(self._jobs)
--> 765             job = self._backend.apply_async(batch, callback=cb)
766             # A job can complete so quickly than its callback is
767             # called before we get here, causing self._jobs to

~/miniconda3/lib/python3.7/site-packages/joblib/_parallel_backends.py in apply_async(self, func, callback)
206     def apply_async(self, func, callback=None):
207         """Schedule a func to be run"""
--> 208         result = ImmediateResult(func)
209         if callback:
210             callback(result)

~/miniconda3/lib/python3.7/site-packages/joblib/_parallel_backends.py in __init__(self, batch)
570         # Don't delay the application, to avoid keeping the input
571         # arguments in memory
--> 572         self.results = batch()
573
574     def get(self):

~/miniconda3/lib/python3.7/site-packages/joblib/parallel.py in __call__(self)
251         with parallel_backend(self._backend, n_jobs=self._n_jobs):
252             return [func(*args, **kwargs)
--> 253                     for func, args, kwargs in self.items]
254
255     def __reduce__(self):

~/miniconda3/lib/python3.7/site-packages/joblib/parallel.py in <listcomp>(.0)
251         with parallel_backend(self._backend, n_jobs=self._n_jobs):
252             return [func(*args, **kwargs)
--> 253                     for func, args, kwargs in self.items]
254
255     def __reduce__(self):

~/miniconda3/lib/python3.7/site-packages/sktime/forecasting/ets.py in _fit(error, trend, seasonal, damped)
271                     dates=self.dates,
272                     freq=self.freq,
--> 273                     missing=self.missing,
274                 )
275                 _fitted_forecaster = _forecaster.fit(

~/miniconda3/lib/python3.7/site-packages/statsmodels/tsa/exponential_smoothing/ets.py in __init__(self, endog, error, trend, damped_trend, seasonal, seasonal_periods, initialization_method, initial_level, initial_trend, initial_seasonal, bounds, dates, freq, missing)
454             )
455             if seasonal_periods is None:
--> 456                 self.seasonal_periods = freq_to_period(self._index_freq)
457             if self.seasonal_periods <= 1:
458                 raise ValueError("seasonal_periods must be larger than 1.")

~/miniconda3/lib/python3.7/site-packages/statsmodels/tsa/tsatools.py in freq_to_period(freq)
810     if not isinstance(freq, offsets.DateOffset):
811         freq = to_offset(freq)  # go ahead and standardize
--> 812     freq = freq.rule_code.upper()
813
814     if freq == 'A' or freq.startswith(('A-', 'AS-')):

AttributeError: 'NoneType' object has no attribute 'rule_code'

# Fixed code
def __init__(
    self,
    error="add",
    trend=None,
    damped=False,
    seasonal=None,
    sp=1,
    initialization_method="estimated",
    initial_level=None,
    initial_trend=None,
    initial_seasonal=None,
    bounds=None,
    dates=None,
    freq=None,
    missing="none",
    start_params=None,
    maxiter=1000,
    full_output=True,
    disp=False,
    callback=None,
    return_params=False,
    auto=False,
    information_criterion="aic",
    allow_multiplicative_trend=False,
    restrict=True,
    additive_only=False,
    n_jobs=None,
    **kwargs,
):
    # Model params
    self.error = error
    self.trend = trend
    self.damped = damped
    self.seasonal = seasonal
    self.sp = sp
    self.initialization_method = initialization_method
    self.initial_level = initial_level
    self.initial_trend = initial_trend
    self.initial_seasonal = initial_seasonal
    self.bounds = bounds
    self.dates = dates
    self.freq = freq
    self.missing = missing

    # Fit params
    self.start_params = start_params
    self.maxiter = maxiter
    self.full_output = full_output
    self.disp = disp
    self.callback = callback
    self.return_params = return_params
    self.information_criterion = information_criterion
    self.auto = auto
    self.allow_multiplicative_trend = allow_multiplicative_trend
    self.restrict = restrict
    self.additive_only = additive_only
    self.n_jobs = n_jobs

    super(AutoETS, self).__init__()