Repository navigation
ENH: Add naive seasonal decomposition function - #1484
Conversation
|
I will look at it tonight. overall for 2d, I was thinking of two or three versions
several things I didn't manage because scipy didn't have proper multivariate filters. scipy.signal has improved a lot since then. for some parts I tried to replicate built-in functions in GAUSS, to try to replicate some research code of econometricians I knew. for the usecases the filter can go in two directions depending whether we want to estimate (get y_predicted/one-step-ahead prediction, unknown error) or we want to simulate (get y, observed error) |
|
Ok, yeah. That's roughly what I thought. Parallel is easy. The rest, I didn't really look at. Might be broken now. Looks like I'm on too new numpy. Hard to beleive nanmean was added in 1.8.0. |
|
I'd like to merge this to use it for the tests for exponential smoothing. Once we have a decomposed function it's easy to make many different types of series. Trend, no-trend, exponential trend, no-trend seasonality, etc. Should I just pull out the untested cases from recursive_filter and convolution_filter? Alternatively, we leave them in. They never really were tested and should work as they were (with correct names now). The only thing I know doesn't work right is |
|
Actually, I can just rebase on top of this and work off that then rebase off master once it's settled. Not pressing. |
|
I'm wanting to go ahead and merge this. What was there wasn't strictly correct (it wasn't an AR filter). Now the part's that used at least we know is correct. and things are correctly delineated. One possible option is just to disable the parts I'm not sure about if they're correct. I really don't want to take the time to write tests for the other parts of this code. |
|
Cherry-picked a few commits from #1489. That will still need a rebase before merging. Might still want to consider using the pandas wrappers decorators that tsa (and predict, eventually) as actual decorators. I'm just mocking the decorator pattern with two lines rather than using it for what it's for right now. I decided that fun is overrated and added tests and pandas wrappers to There's also a plot method for the result now. This is good to merge as far as I'm concerned. 2d filtered coefficients should be looked and made to work (if they don't) at some point though. |
|
I also added a note about the backwards incompatible changes to removing the incorrect |
|
I went ahead and removed the 2d stuff for the |
There was a problem hiding this comment.
not worth saving two letters filter
There was a problem hiding this comment.
actually, better would be filter_coeff because it's not the polynomial it's the AR coefficients (negative and no leading 1)
There was a problem hiding this comment.
filter is a "reserved word"
There was a problem hiding this comment.
Eh, really? It makes everything more verbose without really adding much IMO given it's laid out for you in the docs.
There was a problem hiding this comment.
I'm NOT reading docs, or at least, I don't want to look at them each time I use a function.
Don't use the same word to mean two different things. If I ever have to use this function, my first guess would be that it's a AR filter, i.e. a lag polynomial. (ar versus ar_coeffs is very clear in my opinion.)
(However, pandas became very popular with 2 and 3 letter names, -- I still haven't figured it out.)
There was a problem hiding this comment.
Again, not reading the docs isn't a valid argument for me. I don't write them to not be looked at.
Where are we using the same word to mean two different things? The docs should be cleared up to call them AR coefficients (as it is in R).
I'd rather go back to a than filter_coeffs.
|
I don't really have a strong opinion, since I haven't been working on this for a long time. Dropping the extra dimension handling is fine, until we run into usecases where we need it. (I don't remember which multivariate dynamic model I had in mind.) |
|
I just wanted tested code in there and didn't want to spend anymore time correcting what was only a helper function for my original need. Easy to extend later, if someone comes knocking, but no one noticed before. We'll see. |
|
I addressed all of the comments. We'll see what travis says. I'd like to merge this asap to get it off my plate and we can come back around to it when/if we need to. |
|
Test failure is unrelated. I'm going to rebase and merge this. |
ENH: Add naive seasonal decomposition function
ENH: Add naive seasonal decomposition function
This adds a function seasonal_decompose that does a naive seasonal decomposition. It's pretty much the same as R's
decomposefunction as far as functionality goes. I doubt anyone would ever want to use this in practice vs. model-based approaches, but it's ok for a quick look I suppose, and it gets the ball rolling a bit more. It needs a namespace decision. I'm thinkingtsa.seasonal. It's not right/obvious in the filters namespace really. I also need to add a note and example to the release docs.I expect that the first commit will be more contentious. I renamed
arfilter->convolution_filterand I added a truearfilterasrecursive_filter. Unfortunately, they don't handle missing data well because of scipy/scipy#3454. I probably won't tackle that on this PR. I also didn't add any tests for these because I ran out of steam, and I just wan't sure what you were after for the 2d cases. I thinkrecursive_filterwill need to consider many cases 2d x, 2d filt, and/or 2d init. I think it'd be trivial to add some tests. E.g., just do the same thing over and over again in different dimensions. I'm just not seeing it in the code yet. It also needs to handle pandas-in pandas-out and dates with the wrapper functions.