Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I remove stochasticity from Prophet? #849

Closed
AdrianP- opened this issue Feb 14, 2019 · 1 comment
Closed

How can I remove stochasticity from Prophet? #849

AdrianP- opened this issue Feb 14, 2019 · 1 comment

Comments

@AdrianP-
Copy link

Hi, how can I add a seed in python to always return the same values in seasonality/forecast? With and without mcmc.

Thanks!

@bletham
Copy link
Contributor

bletham commented Feb 20, 2019

--- Fitting ---
Without MCMC, the fitting is as deterministic as we can get it. All data transforms are deterministic, the initial value used for the optimization is deterministic. The optimizer used in Stan (L-BFGS) is in principle deterministic, but we do see some variance in the fitted parameters across runs. This is probably because the likelihood surface around the optimal can be quite flat (model identifiability is not always great) and so numerical noise becomes a factor. This is usually a very small variance, but it does exist. It is the only variance in fitting without MCMC.

With MCMC, it looks like PyStan accepts a seed, which you could pass along with m.fit(df, seed=1000). I haven't actually checked how deterministic the MCMC sampling is when given the seed.

--- Prediction ---
The main estimates (yhat, weekly, etc.) will all be deterministic, given fixed model parameters. So the only source of variance in these estimates is the variance in model fit parameters described above.

The uncertainty intervals for yhat and trend (yhat_lower, trend_upper, etc.) are computed with a Monte Carlo simulation. This happens entirely in Python in numpy, so setting the numpy seed prior to calling predict (np.random.seed(1000)) will make render those deterministic also. (But again for fixed model parameters, so there can be variance here based on variance in fitted model parameters from above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants