Skip to content

An inference only fork of Prophet (Python only)

License

Notifications You must be signed in to change notification settings

randyphoa/prophet-inference

 
 

Repository files navigation

Prophet Inference: An inference only fork of Prophet (Python only)

This is an inference only fork of Prophet for Python.

As the name suggests, this is a stripped down version of Prophet that supports only inferencing from a fitted Prophet model.

The primary purpose of this package is to deploy a Prophet model in a light weight environment for the purpose of inference/prediction. This implementation does not require heavy dependencies such as pystan(Stan) and Cython which requires a C/C++ compiler. It is a purely Python based and does not require additional binaries.

In most cases, training the Prophet model is done on a development environment such as Jupyter Notebooks or Python scripts and rarely in a deployment environment. This package can be installed in the deployment environment easily and perform inference/predictions from the earlier developed models.

In summary, the main changes are,

  • removed dependencies Cython, cmdstanpy and pystan from requirements.txt
  • commented out Stan related code

Refer to the original implementation for more details.

Example

An end-to-end example from training to inference in IBM Watson Machine Learning can be found in this notebook.

More details can be found at https://medium.com/@randyphoa/making-predictions-with-prophet-on-ibm-watson-machine-learning-abc42ca129f3

Installation in Python

Prophet Inference is on PyPI, so you can use pip to install it.

pip install fbprophet

Train the Prophet model and export model parameters

# create and fit model
df = pd.read_csv("data.csv")
m = Prophet()
m.fit(df)
# export data to json using fbprophet_inference
model_json = fbprophet_inference.serialize.model_to_json(m)

Import model parameters and call the predict functions

# Remember that this is an inference-only instance of Prophet and you should only call the predict function.
model = fbprophet_inference.serialize.model_from_json(model_json)
model.predict(df)

Prophet Inference is licensed under the MIT license.

About

An inference only fork of Prophet (Python only)

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 59.1%
  • R 33.1%
  • Jupyter Notebook 5.0%
  • Stan 2.7%
  • Dockerfile 0.1%
  • Makefile 0.0%