Skip to content

ENH: Improve speed in Exponential Smoothing - #4845

Merged
josef-pkt merged 13 commits into
statsmodels:masterfrom
bashtage:add-frequency-inference
Aug 12, 2018
Merged

josef-pkt merged 13 commits into
statsmodels:masterfrom
bashtage:add-frequency-inference

Conversation

@bashtage

@bashtage bashtage commented Aug 7, 2018 •

Copy link
Copy Markdown
Member

Add Cython version of all smoothers, providing gains of ~ 50x for relevant models sizes
Fixed a bug that affected multiplicative trend initial values
Add ability to set starting values
Add ability to fix all model parameters or any subset
Improve model initialization options to speed up fitting if desired
Improve tests
Added summary
Added params_formatted which returns a DataFrame. I did not want deprecation headaches so left params as it is -- a dictionary.

xref #4842

@bashtage

bashtage commented Aug 7, 2018

Copy link
Copy Markdown
Member Author

@tvanzyl If you are still around it would be helpful if you could look at this. In particular, the change to the initialization of the trend when it is multiplicative.

@tvanzyl

tvanzyl commented Aug 7, 2018 via email

Copy link
Copy Markdown
Contributor

@coveralls

coveralls commented Aug 7, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 83.684% when pulling 2ebdb1b on bashtage:add-frequency-inference into d7b1ac0 on statsmodels:master.

@codecov-io

codecov-io commented Aug 7, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #4845 into master will increase coverage by 0.01%.
The diff coverage is 96.6%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4845      +/-   ##
==========================================
+ Coverage   81.14%   81.15%   +0.01%     
==========================================
  Files         581      581              
  Lines       89927    90160     +233     
  Branches    10043    10071      +28     
==========================================
+ Hits        72968    73173     +205     
- Misses      14677    14688      +11     
- Partials     2282     2299      +17
Impacted Files Coverage Δ
statsmodels/tsa/x13.py 20.24% <0%> (-0.17%) ⬇️
statsmodels/tsa/tests/test_holtwinters.py 100% <100%> (ø) ⬆️
statsmodels/tsa/holtwinters.py 90.19% <94.56%> (-4.9%) ⬇️
statsmodels/tsa/tsatools.py 90.71% <0%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7b1ac0...2ebdb1b. Read the comment docs.

@bashtage
bashtage force-pushed the add-frequency-inference branch from ee46fba to 156b293 Compare August 7, 2018 13:12
Comment thread statsmodels/tsa/holtwinters.py Outdated
b[i] = (beta * (l[i] / l[i - 1])) + (betac * b[i - 1] ** phi)
s[i + m - 1] = y_gamma[i - 1] - \
(gamma * (l[i - 1] * b[i - 1]**phi)) + (gammac * s[i - 1])
(gamma * (l[i - 1] * b[i - 1] ** phi)) + (gammac * s[i - 1])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we didn't use spaces around power **

@josef-pkt

Copy link
Copy Markdown
Member

I only did a partial skimming of the changes and didn't see any problems.

@ChadFulton

Copy link
Copy Markdown
Member

Great addition to the exponential smoothing models!

@tvanzyl

tvanzyl commented Aug 8, 2018

Copy link
Copy Markdown
Contributor

Had a quick look over. Great improvements to the models.

bashtage added 13 commits August 9, 2018 16:00
Add Cython implementation which improves performance by up to a factor of 50
Add suppose for fixing initial values of level and slope
Add support for starting values
Add ability to set start params
Add ability to set start values
Ensure multiplicative trend is always positive
Add formatted parameter output
Add summary
Correct error types from NotImplementedError to ValueError
Simplify seasonal period inferecne
Ensure start params have the correct shape
Fix buggy test due to inapporpriate starting values for multiplicative trend
Add test to directly compare single and double exp smoothing
Add additional documentation and fix typos
Add check that nobs-k-3>0 before calculating aicc, and return inf if not

closes statsmodels#4796
closes statsmodels#4825
closes statsmodels#4762
Split out initial value culaculation so that that initial values
are accessible to users
Fix small typos
Prevent warnings from pandas
Use preferred one form tsatools
@josef-pkt

Copy link
Copy Markdown
Member

I only did a very coarse skimming.
I'm merging this given there are no problems pointed out with it.
(I didn't check for backwards incompatible changes given that this was only recently added to statsmodels.)

@bashtage Thank you

@josef-pkt
josef-pkt merged commit 316f044 into statsmodels:master Aug 12, 2018
@bashtage

bashtage commented Aug 12, 2018 via email

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants