Giter Site home page Giter Site logo

Comments (12)

luke14free avatar luke14free commented on August 25, 2024 1

This seems like a real bug, well spotted. Investigating as it might be a major improver of the quality of the seasonality fitter

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

thank you for answering, did you take the time to look at the source code ? Do you agree that it is a bug?

from pm-prophet.

luke14free avatar luke14free commented on August 25, 2024

Yes, I just verified it :) working on a fix

from pm-prophet.

luke14free avatar luke14free commented on August 25, 2024

Screenshot 2020-07-31 at 16 27 45

very happy that this also solves an issue with multiplicative seasonality not behaving as expected, adding a test for this :)

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

how was the previous result in comparison?

from pm-prophet.

luke14free avatar luke14free commented on August 25, 2024

So the issue should be resolved on master (I didn't deploy the pakcage to pypy yet though). I am running this code for testing this:

    z = np.sin(np.linspace(0, 200, 200)) * np.linspace(0, 200, 200)
    df = pd.DataFrame()
    df["ds"] = pd.date_range(start="2018-01-01", periods=200)
    df["y"] = z
    m = PMProphet(df, auto_changepoints=False, growth=True, intercept=False, name="model")
    with m.model:
        m.priors['growth'] = pm.Constant('growth_model', 1)
    m.add_seasonality(seasonality=3.14 * 2, fourier_order=3, mode=Seasonality.MULTIPLICATIVE)
    m.fit()
    m.predict(60, alpha=0.2, include_history=True, plot=True)
    m.plot_components(intercept=False)

you can probably try to see what happens in previous versions (maybe the sine series was already sufficient :)

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

Hi,
I am still not sure the fourier series are modelled correctly in the updated master. In line 709 in the master, the fourier order is set to max(order) + 1, witch is setting the fourier order to 8, resulting in self.data having 16 entries of sine/cos. I believe the result is actully correct as the enumeration of self.seasonality in line 455 ignores the last 8 entries of self.data

from pm-prophet.

luke14free avatar luke14free commented on August 25, 2024

Hi @BjorHart, that's not correct actually. What 709 does is to set the seasonality, say in case you do 8 it will be:

f_{period}_{order}_{sin/cos} starting from 0 to 7 (that's why the +1) with sin/cos. This is given by line 193 (double for loop both on the period and on the function). This extends the self.seasonality to have all the seasonality duplicated with sin/cos. So the enumeration at line 455 doesn't ignore the remaining 8 because they are all added to the same array.

You can inspect model.seasonality and also model.data to check what I said :) or simply use a debugger.

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

Thank you for getting back to me so quickly!
ah yes, I am sorry, I have a local version that I fixed in a different way, but i now see what i missed in your solution. thank you!

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

Hi again!
I was trying to run the multiplicative example that you provided. I keep getting divergencies during the sampling process. How may this affect our results?

from pm-prophet.

luke14free avatar luke14free commented on August 25, 2024

Is this with the code on master?

from pm-prophet.

BjorHart avatar BjorHart commented on August 25, 2024

yes thats correct!

from pm-prophet.

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.