Skip to content

ENH: Add automated model selection for TSA models - #5151

Open
ChadFulton wants to merge 1 commit into
statsmodels:mainfrom
ChadFulton:automatic
Open

ChadFulton wants to merge 1 commit into
statsmodels:mainfrom
ChadFulton:automatic

Conversation

@ChadFulton

Copy link
Copy Markdown
Member

This PR is a follow-up to #4621 (automatic methods GSOC), that so far does two things:

  • Rewrites exponentialsmoothing.py and sarimax.py to standardize the interface, provide more comprehensive results, and add a variety of ways to specify the model search space.
  • Adds structural.py that adds support for UnobservedComponents models.

A notebook showing the basics of the proposed interface is at https://gist.github.com/ChadFulton/eb3f926e8925072196efa3c75e7987f5

Of course this is very early stages. Two big TODOs are:

  • Unit tests
  • Try to abstract out some of the functionality to avoid the boilerplate in each file.

(I will be out of touch for the next few days so I won't be responding, but any feedback would be greatly appreciated!)

res = None
value = np.nan
exception = e
raise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh? How is this different than just not having the try/except?

@@ -0,0 +1,659 @@
"""
Automatic model selection for SARIMAX models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Structural

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.6%) to 83.372% when pulling 055fd26 on ChadFulton:automatic into 0e41ebd on statsmodels:master.

@jbrockmendel

Copy link
Copy Markdown
Contributor

Could be a nice API addition. Helper functions to deduplicate code will be nice. I’ll look again when at a real keyboard.

models_table = SimpleTable(params_data,
param_header,
params_stubs,
title='Evaluated models',

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.

travis failures are pep-8, e.g. overindended line

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once addressed, please add all these new files to lint.sh

@josef-pkt

Copy link
Copy Markdown
Member

main question I have without looking much is authorship.
We should have Abhijeet as commit author for his GSOC work.

Who is the author and can we split it at least partially by author?
Is #4621 going on top of this, i.e. to be merged later?

Comment thread statsmodels/tsa/api.py
from .holtwinters import ExponentialSmoothing, SimpleExpSmoothing, Holt No newline at end of file
from .holtwinters import ExponentialSmoothing, SimpleExpSmoothing, Holt

from .automatic import api as automatic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you were to define __all__ and change the from .stattools import * to explicit imports, that would save me some teeth-pulling.

@ChadFulton

Copy link
Copy Markdown
Member Author

main question I have without looking much is authorship.
We should have Abhijeet as commit author for his GSOC work.

Who is the author and can we split it at least partially by author?
Is #4621 going on top of this, i.e. to be merged later?

The ideal situation is that #4621 is improved by @abhijeetpanda12 and we merge that PR, in which case this PR could be dropped completely. In its current state, #4621 it is not ready to be merged, and my main hope with this PR is that it can be used by Abhijeet as a reference for improving his PR (e.g. the type of inputs that would be useful, the type of outputs that are in the Statsmodels style) - although I don't want to just see this copy / pasted into #4621. In the worst case, we have this PR to fall back on and merge instead.

(As far as authorship of this PR: All the code in this PR was written by me - it's like my PR with the alternative approach to exponential smoothing (#4183). It takes lessons from the work in #4621 (and so has Abhijeet listed in the Author: fields of the relevant files) but could be merged by me, since I wrote the code.)

@abhijeetpanda12

Copy link
Copy Markdown

I have had glanced through the contents of this PR, and I can see most of the changes are to do with the results of the model specifications.
@ChadFulton Thank you for adding me as an Author to the relevant files.
I agree that #4621 is not in a stage to be merged. But I would try to look into that and improve it. This PR might be a useful resource for me. But these days I am busy with a lot of academic assignments(I got into my graduate school) and taking out time is tough for me during the initial months. If this feature has to stay for a month or two, then I can work and complete my project with all the improvements.

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