stan_backend is missing when loading model from json
See original GitHub issuefrom fbprophet.serialize import model_to_json, model_from_json
with open("serialized_model.json", "r") as fin:
fb_model = model_from_json(json.load(fin))
df_cv = cross_validation(fb_model, ............)
It produces this error,
File "C:\Users\XXXXX\.conda\envs\fbprophet7\lib\site-packages\fbprophet\diagnostics.py", line 295, in prophet_copy
stan_backend=m.stan_backend.get_type()
AttributeError: 'NoneType' object has no attribute 'get_type'
Code snippet from diagnostics.py
m2 = m.__class__(
growth=m.growth,
n_changepoints=m.n_changepoints,
changepoint_range=m.changepoint_range,
changepoints=changepoints,
yearly_seasonality=False,
weekly_seasonality=False,
daily_seasonality=False,
holidays=m.holidays,
seasonality_mode=m.seasonality_mode,
seasonality_prior_scale=m.seasonality_prior_scale,
changepoint_prior_scale=m.changepoint_prior_scale,
holidays_prior_scale=m.holidays_prior_scale,
mcmc_samples=m.mcmc_samples,
interval_width=m.interval_width,
uncertainty_samples=m.uncertainty_samples,
stan_backend=m.stan_backend.get_type()
)
It errors out when it tries to copy another model object I can comment out “stan_backend=m.stan_backend.get_type()” to make it work, not sure if it has any complication or raise any concern.
Can be easily replicated when you load a model from json, using FBProphet v0.7 on windows.
from fbprophet.serialize import model_to_json, model_from_json
with open('serialized_model.json', 'r') as fin:
fb_model = model_from_json(json.load(fin))
fb_model.stan_backend.get_type()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-104-5351aed8e4ed> in <module>
----> 1 fb_model.stan_backend.get_type()
AttributeError: 'NoneType' object has no attribute 'get_type'
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Frustrating problems with Pystan (anaconda Python)
Hello everyone, I am new to Stan, and I am currently trying to run a Bayesian model using Pystan as my interface.
Read more >Time Series Part 3: Forecasting with Facebook Prophet: An Intro
Prophet is robust to missing data and shifts in the trend, and typically handles outliers well. ... m = model_from_json(json.load(fin)) # Load model...
Read more >How to convert from Tensorflow.js (.json) model into ...
Convert the Keras HDF5 file into a SavedModel (standard Tensorflow model file) or directly into .tflite file using the TFLiteConverter.
Read more >Deploying Prophet model with custom environments on IBM ...
In Python, models should not be saved with pickle; the Stan backend attached to the model object will not pickle well, and will...
Read more >Prophet: Automatic Forecasting Procedure - Morioh
Prophet is robust to missing data and shifts in the trend, and typically ... You can also choose an experimental alternative stan backend...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The fix has been pushed to pypi in the new v1.0 (with the new package name, prophet)
This is fixed in eb6b8f6. Here is a test case: