Save serialized prophet model
See original GitHub issueHi,
I tried using the kats package with the default prophet functions to serialize the prophet model using the below code:
from kats.models.prophet import ProphetModel, ProphetParams
import json
from prophet.serialize import model_to_json, model_from_json
# create a model param instance
params = ProphetParams(seasonality_mode=args.seasonality_mode) # additive mode gives worse results
m = ProphetModel(DATA_DF, params)
m.fit()
save_model(m, 'serialized_model.json')
def save_model(model, file_name):
with open(file_name, 'w') as file:
json.dump(model_to_json(model), file)
Currently, it is throwing this error:
Traceback (most recent call last):
File "kats_example.py", line 67, in save_model
json.dump(model_to_json(model), file)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/prophet/serialize.py", line 56, in model_to_json
if model.history is None:
AttributeError: 'ProphetModel' object has no attribute 'history'
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Additional Topics | Prophet - Meta Open Source
It is possible to save fitted Prophet models so that they can be loaded and used later. ... The json file will be...
Read more >How to save a fbprophet forecast model using pickle such that ...
It is possible to save fitted Prophet models so that they can be loaded and used later. In Python, models should not be...
Read more >Time Series Part 3: Forecasting with Facebook Prophet: An Intro
Saving Prophet models is a bit different than saving SARIMAX models. In Python, Prophet models should not be saved with pickle; the Stan...
Read more >How to save Prophet models in Dataiku and use them across ...
Alternatively, you can serialize the model to json, save it locally, and then load the model within another project.
Read more >Download button to save Facebook Prophet models (json ...
Hi guys, I'm trying to create a download button save Facebook Prophet models, a forecasting utility. FYI, here's the code to do a...
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 Free
Top 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
@neelabalan that did work, thanks!
did you use
trained_model.model
? The difference isThe above backtester example works fine for me