Skip to content

REF: deprecate ARMA/ARIMA in favor of SARIMAX ? #3884

Open

Description

@josef-pkt

related:
roadmap for tsa #3115
old issue to compare of ARIMA and SARIMAX #2542

The long term plan is to deprecate ARMA and ARIMA to avoid code duplication and because those models are barely maintained. We will not be able to remove them fast after deprecation, but we need to start directing users to SARIMAX. There might be or is some functionality that does not have a close substitute yet, and we need to get a better overview of the different usecases.

Can we deprecate ARMA/ARIMA in favor of SARIMAX? What's missing?

  • model.predict: we still have little out of the box support to predict on new datasets without reestimation. ARMA has predict in the model class, SARIMAX doesn't ARMA.predict() #3882 (comment)
  • ...

Activity

  1. jbrockmendel commented on Aug 26, 2017

    @jbrockmendel
    Contributor

    I'm -1 on this.

    The statespace models are great for their specific purpose, but their learning curve is way harder than the plain-python tsa models. Moreover, we don't have test coverage for the cython code, and @ChadFulton is basically the only person qualified to maintain them.

    That said, you're right that a bunch of the scalar tsa models have been neglected. I've got branches that do a bunch of cleanup+testing, can turn those into PRs if you've got room in the pipeline. I do advocate merging arma_mle back into arma_model.

    Last point: if we're talking about deprecation/removal, let's start with code that is unused/unfinished like tsa.descriptivestats, tsa.mlemodel, and most of tsa.varma_process.

  2. josef-pkt commented on Aug 26, 2017

    @josef-pkt
    MemberAuthor

    The main point right now is that Chad is maintaining the statespace models, while ARMA/ARIMA are in minimal maintenance mode.

    However, even if or when we decide to deprecate ARMA/ARIMA we will not be able to remove it anytime soon because it has a long history and many users. The point now would be to make it easier for users to transition to SARIMAX and to make sure we have equivalent functionality there.

    Last point: if we're talking about deprecation/removal, let's start with code that is unused/unfinished like tsa.descriptivestats, tsa.mlemodel, and most of tsa.varma_process.

    The main difference to ARIMA is that those don't require more than a tiny bit of maintenance because they are not in use.
    What I would like to be able to do is answering question about limitations of ARIMA with "SARIMAX can already do that (or it would be easier to add a feature there)"

    From a standard user perspective I think SARIMAX and other statespace model are essentially as easy to use as ARIMA. The underlying code is more complex because it is build on a full statespace "framework".
    ARMA has it's own specific kalman filter in cython, so there is not principal difference, except that statespace is more complex (and personally I wouldn't want to have to look at either cython code).

    (My pipeline had much lower capacity this month than expected because of an accident in the family. Fortunately nothing permanent.)

  3. ChadFulton commented on Aug 26, 2017

    @ChadFulton
    Member

    I am +1 for deprecation regardless of what comes next. Then I am +1 for using SARIMAX or +0 for a separate rewrite (+1 if someone else volunteers :).

    To me, the main problem is that these models don't conform to the current Statsmodels norms, so there's a lot of behavior that works for these models that I think we would want to deprecate even if the models were currently well maintained.

    The next problem is that the current code seems to have a variety of corner case bugs and generally is due for a "tune up" refactoring. It sounds like maybe you (@jbrockmendel) have been working on these?

    The final problem is that, in my opinion, it's a pain to write some of the code for ARIMA models when not using the Kalman filter. The main one that comes to my mind is prediction.

    But I'm sympathetic to the idea that if I (pick your risk metaphor) get hit by a bus then it would be tough to maintain the Cython underlying the state space models (but if you want to support full MLE then you need something somewhere, as Josef mentioned). But if it's appealing to have separate classes for them, that's okay by me. I'd be happy to help support them, as long as it was clear what was going on and everything was consistent.

  4. jbrockmendel commented on Aug 26, 2017

    @jbrockmendel
    Contributor

    The main point right now is that Chad is maintaining the statespace models

    This is a compelling argument. Despite all my griping, the statespace models are excellent.

    The main difference to ARIMA is that [unfinished/unused modules] don't require more than a tiny bit of maintenance because they are not in use.

    This is probably a separate discussion. There is a cost for users and maintainers to having dead code lying around. It does not contribute to making a good impression on prospective users/developers.

    the main problem is that these models don't conform to the current Statsmodels norms

    I would be ecstatic to fix this. Both in the scalar and vector_ar models. Just give me the green light. Getting "permission" to refactor has been a bit like pulling teeth.

    It sounds like maybe you (@jbrockmendel) have been working on these?

    Yes. I've got piles of fixes lying around, but have been holding off on PRs since @josef-pkt went out of town earlier this summer. Once the current PR backlog starts clearing up, I'll be happy to start pushing those.

    My pipeline had much lower capacity this month than expected because of an accident in the family. Fortunately nothing permanent.

    Sorry to hear that. Hope all is well.

  5. josef-pkt commented on Aug 26, 2017

    @josef-pkt
    MemberAuthor

    about cython code:
    Once the cython code works correctly, it has been very low maintenance in the past. The cython code underlying ARIMA didn't have any problems in a long time. The cython developers seem to be pretty good in maintaining backwards compatibility and adding support for new python versions without us having to do anything or at most a few adjustments.
    So I would assume that maintaining cython code would be feasible even if there is no one available to write the cython code or extensions to it in the first place.

  6. josef-pkt commented on Aug 26, 2017

    @josef-pkt
    MemberAuthor

    about refactoring reviewing:
    there are some necessary refactorings that can get high priority.
    E.g. initializing keyword in fit instead of __init__ which showed up again here #3882 (comment)
    ARMA/ARIMA was written in the second GSOC of Skipper were it wasn't clear yet what should be in __init__ and what in the fit method. (order has been moved from fit to init already. In a pure ARMA model order is not really a property of the data if lag-polynomials are defined and estimated in fit.)

  7. jbrockmendel commented on Aug 28, 2017

    @jbrockmendel
    Contributor

    The question of where k_ar or order gets set is probably off-topic, is a difficult problem. I think eventually there will need to be a class (hierarchy) that precedes Model and represents a collection of different specifications/models. But that's a can of worms I'm not prepared to open at the moment.

  8. astrojuanlu commented on Dec 10, 2018

    @astrojuanlu

    What can we expect from a users point of view? Should we invest time in learning SARIMAX, since AR(I)MA are going to be deprecated at some point? Can we assume this deprecation won't take place for the next scheduled release (0.11 0.10 at the time of writing)? Should we expect breaking changes in SARIMAX to conform to statsmodels?

  9. astrojuanlu commented on Dec 10, 2018

    @astrojuanlu

    (Edit: next release is 0.10)

  10. josef-pkt commented on Dec 10, 2018

    @josef-pkt
    MemberAuthor

    Learning how to use SARIMAX is a good idea in any case because that's were all the enhancements went in the last few years and will be going to in future. It also shares much of the code with other statespace models that can be useful for similar use cases. ARIMA is in basic maintenance mode.
    The main interface of SARIMAX is largely the same and has the same TSA base class, so the differences are not very large.

    We have not planned to deprecate ARIMA for 0.10. Even when we deprecate thos classes, then they will not be removed for 2 to 3 years after unless there are some unforseen problems with new Python and Cython versions that are very difficult to fix. This is a very unlikely event after it has worked for around 9 years.

  11. ChadFulton commented on Dec 10, 2018

    @ChadFulton
    Member

    I think this is somewhat up in the air, but nothing will change quickly. You can be certain that AR, ARMA, and ARIMA will remain in their current form for v0.10. SARIMAX is already in the correct style, and I don't expect any changes / deprecations to that class.

    I think it would be great to add deprecation warnings for v0.10 to give users as much as possible to adjust to changes that we know are going to happen, but that depends on if we can straighten out what needs to be deprecated and what will replace it in time for the release.

    In particular, AR, ARMA, ARIMA are written in an old style that has order and trend specified in the fit method instead of in the constructor. This is (if I remember right) the main thing that has to be deprecated.

    SARIMAX is the most complete and maintained model, so there is certainly nothing wrong with learning how to use it.

    I would guess that we may not remove the AR, ARMA, ARIMA models themselves, since more people recognize them than recognize SARIMAX. In the long run, my preference is to bring those models into line with the SARIMAX style and then make them subclasses of SARIMAX.

  12. astrojuanlu commented on Dec 10, 2018

    @astrojuanlu

    Thanks a lot! This information is very useful. Keep rocking 💪

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions