Giter Site home page Giter Site logo

Minimum orders in auto_arima about pmdarima HOT 2 OPEN

dilwong avatar dilwong commented on July 18, 2024
Minimum orders in auto_arima

from pmdarima.

Comments (2)

Relor91 avatar Relor91 commented on July 18, 2024 2

I have the same issue, it is driving me mad. I am trying to figure it out in the code, will let you know if I manage to fix it

from pmdarima.

Relor91 avatar Relor91 commented on July 18, 2024

I found how to deal with it, but beware, this is not an official solution by the people who made the original API, I made it to make my work easier. Also I am not sure if it will damage the overall Stepwise search or anything else, nevertheless if you don't use Stepwise, for now it does seem to work:
Go to the auto.py file by clicking on auto_arima, scroll down to "search = solvers._RandomFitWrapper", you will need to add the below to this function:
start_p=start_p,
start_q=start_q,
start_P=start_P,
start_Q=start_Q
Save it, now go to the _auto_solvers.py and search for the function "class _RandomFitWrapper(_SolverMixin):"
Substitute this function with the below:
class _RandomFitWrapper(_SolverMixin):
"""Searches for the best model using a random search"""

def __init__(self, y, X, fit_partial, d, D, m, max_order,
             start_p, max_p, start_q, max_q, start_P, max_P, start_Q, max_Q, # added start_p, start_q, start_P, start_Q
             random, random_state,
             n_fits, n_jobs, seasonal, trace, with_intercept,
             sarimax_kwargs):

    if seasonal:
        gen = (
            ((p, d, q), (P, D, Q, m))
            for p in range(start_p, max_p + 1)  # changed from 0 to start_p
            for q in range(start_q, max_q + 1)  # changed from 0 to start_q
            for P in range(start_P, max_P + 1)  # changed from 0 to start_P
            for Q in range(start_Q, max_Q + 1)  # changed from 0 to start_Q
            #if p + q + P + Q <= max_order
        )
    else:
        gen = (
            ((p, d, q), (0, 0, 0, 0))
            for p in range(start_p, max_p + 1)  # changed from 0 to start_p
            for q in range(start_q, max_q + 1)  # changed from 0 to start_q
            #if p + q <= max_order
        )

    if random:
        random_state = check_random_state(random_state)
        gen = random_state.permutation(np.array(list(gen), dtype='object'))[:n_fits]

    self.gen = gen
    self.n_jobs = n_jobs
    self.trace = trace

    self.fit_partial = functools.partial(
        fit_partial,
        y=y,
        X=X,
        with_intercept=with_intercept,
        **sarimax_kwargs,
    )

Bosh, save and restart your kernel, now the autoarima will respect the start parameters. I also just tried the Stepwise, and confirm that this amateur fix doesn't work when using Stepwise.

from pmdarima.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.