Comments (12)
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.
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.
Yes, I just verified it :) working on a fix
from pm-prophet.
very happy that this also solves an issue with multiplicative seasonality not behaving as expected, adding a test for this :)
from pm-prophet.
how was the previous result in comparison?
from pm-prophet.
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.
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.
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.
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.
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.
Is this with the code on master?
from pm-prophet.
yes thats correct!
from pm-prophet.
Related Issues (20)
- Would you like to consider adding this to pymc-learn and pymc3-models? HOT 1
- UnboundLocalError: local variable 'w' referenced before assignment HOT 2
- AttributeError: 'str' object has no attribute 'value' HOT 2
- AttributeError when fitting example model HOT 1
- Is GPU included? HOT 1
- Non-Linear Forecasting with pm-prophet HOT 5
- auto_changepoint issue HOT 1
- prediction dependent on the order of the added sesonality HOT 3
- time series now/forecasting with distributed data HOT 1
- Example not working on Pandas 1.0 HOT 6
- Categorical Variables HOT 7
- do you have example to use your code like prophet with multiple regressores ? HOT 1
- Multiple extra data
- PyPI repository is not updated
- Heteroskedasticity
- [Feature Request] Simplify API for regressors
- [Feature Request] Ability to customise priors for each regressor
- AttributeError: 'DataFrame' object has no attribute 'ix' HOT 1
- PyMC3 has been renamed PyMC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pm-prophet.