Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_boxcox parameter in holt winters #19

Closed
callmegar opened this issue Oct 20, 2022 · 2 comments
Closed

use_boxcox parameter in holt winters #19

callmegar opened this issue Oct 20, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@callmegar
Copy link

callmegar commented Oct 20, 2022

with this grid:

hwes = {
'trend':['add','mul'],
'seasonal':['add','mul'],
'damped_trend':[True,False],
'initialization_method':[None,'estimated','heuristic'],
'use_boxcox':[True,False],
'seasonal_periods':[168],
}

I get this result which I do not understand as it is True or False:

`File ~/.local/share/virtualenvs/scalecast-0HQw5DtN/lib/python3.10/site-packages/statsmodels/tsa/holtwinters/model.py:337, in ExponentialSmoothing._boxcox(self)
335 y = boxcox(self._y, self._use_boxcox)
336 else:
--> 337 raise TypeError("use_boxcox must be True, False or a float.")
338 return y

TypeError: use_boxcox must be True, False or a float.`

I think the issue may be here:
File ~/.local/share/virtualenvs/scalecast-0HQw5DtN/lib/python3.10/site-packages/statsmodels/tsa/holtwinters/model.py:291, in ExponentialSmoothing.__init__(self, endog, trend, damped_trend, seasonal, seasonal_periods, initialization_method, initial_level, initial_trend, initial_seasonal, use_boxcox, bounds, dates, freq, missing) 289 self._use_boxcox = use_boxcox 290 self._lambda = np.nan --> 291 self._y = self._boxcox() 292 self._initialize() 293 self._fixed_parameters = {}

@mikekeith52 mikekeith52 self-assigned this Oct 21, 2022
@mikekeith52 mikekeith52 added the bug Something isn't working label Oct 21, 2022
@mikekeith52
Copy link
Owner

mikekeith52 commented Oct 21, 2022

This isn't the first time I've seen this issue but I really started digging into it after seeing this issue. Turns out, True or False gets converted from a bool to a numpy.bool_ type between the time the model is tuned and tested. This causes the check kwargs['use_boxcox'] is True to return False, thus raising the issue which originates from statsmodels. Incredible. I will implement a fix in 0.15.3.

mikekeith52 pushed a commit that referenced this issue Oct 21, 2022
- increased documentation around forecasting different model types.
- 'LevelY' passed to history in `util.break_mv_forecaster()`
- changed the optional dependency `pip intall fbprophet` to `pip install prophet` (#18)
- added `IndexError` to the list of exceptions to catch in `util.find_optimal_transformations()` function.
- convert values in `**kwargs` from `numpy.bool_` to `bool` type when forecasting with HWES (#19).
@mikekeith52
Copy link
Owner

Please try it out and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants