You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- 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).
Hi, how can I add a seed in python to always return the same values in seasonality/forecast? With and without mcmc.
Thanks!
The text was updated successfully, but these errors were encountered: