[forecast][fbprophet]method in the time-series forecast

IJN-Kasumi 1939–1945
3 min readFeb 16, 2020

--

A harbor in an East Taiwan city. Pacific ocean is the end. image source: author

Purpose

This article contains the necessary introduction of the fbprophet forecast method in Python. The example code is ready to copy-paste-run for the initial insight.

Introduction

If you are not a computer science background person, that is the trouble in the startup the date-time related forecast task at work. In contrast, the deep-learning forecast methods (LSTM, MLP, RNN..) requires to “create” the model inside the brain while tuning lots of parameters. (No mentioned on the GPU-CUDA environment setup issues). The GlounTSpackage from Amazon is a good candidate[1]. If requires some statistical view result, fbprophet from Facebook(R) company is a consideration. Anyone can buildup the desired time-date related forecast with statistical results in a handy way. (OK, the stock forecast is the typical case.)

Of course, please always obey the license term under legal coverage.

Installation

It is a bit tricky to install fbprophet in my own experience. But still, be solve-able after installing other packages from the error message notification. This package requires to install the .Net framework 4.5.1+, C++ compiler and PyStan package in advance. Please visit the fbprophet GitHub website to start with it and good luck.

Automatic Forecast at Scale

The very good forecast presentation file is below. You can see the same Author’s name on it. thanks to him (their) contribution.

Presentation source: https://www.slideshare.net/seanjtaylor/automatic-forecasting-at-scale

Example Python code

The following example code aims to forecast the utilizes the same data package with GlounTS package example case. The hidden reason is to make the comparison offline.

It is very simple in the steps of the data-assimilation, training dataset, buildup Estimator model, test dataset, make the estimation, convert to forecast data, and prepare output data(plot). Each step contains the remark on the Python code.

fbprophet example code

Example Python result (image)

The computation time is 32.505 seconds in an i7-computer. There is no sign in GPU nor the full CPU cores kick-in the service. Below, the result is displayed in the forecast curve(red color), the upper and lower boundary curves are in the green color and black color, respectively.

Example code result. image source: author

Summary

fbprophet package is recommended to serve as a time-date based forecast core if and only if solve the installation problem. The computation time is good with the C++ solver in the single CPU, no GPU process. In the programing view, the report data vector was summarized in the Python variables without normalization/de-normalization processes. It becomes very handy to convert into the GUI report and SQL database afterward.

Reference

[1]:

[2]: 初识fbprophet

[3]: python-fbprophet總結

--

--