Model Understanding >

Prophet

Prophet is a forecasting model from Facebook. It's a combination of linear regression and seasonalities.

Prophet Model

Prophet uses decomposable time series model defined as $ y(t) = g(t) + s(t) + h(t) + \epsilon_t $ where $g(t)$ is the trend, $s(t)$ is the seasonal (weekly and yearly), $h(t)$ is the holiday component, and $\epsilon_t$ is the error term.

Trend

Prophet supports both saturating growth and piecewise linear trends. In saturating growth, the growth rate slows down over time. In piecewise linear trends, the growth rate remains constant within each segment. Prophet allows the selection of the number of changepoints, which determines the number of piecewise linear segments. Given that coins are expected to exhibit varying trends, we use piecewise linear trends.

Seasonality

Seasonality in Prophet is modeled using a Fourier series, which is a sum of sine and cosine functions with different frequencies. This can be automatically detected by the model or manually specified by the user. In our case, we rely on automatic seasonality detection to reduce the complexity of hyperparameter tuning.

Holiday

The holiday component in Prophet is represented as a binary variable, where 1 indicates a holiday and 0 indicates a non-holiday. However, since there are no holidays in the trading dates of coins, this component is not utilized in our model.

Prophet for Air Passengers

To demonstrate model performance, we show the model's prediction results for the air passengers dataset. The cross validation process identified the best transformation to make the time series stationary and the optimal hyperparameters. The Root Mean Squared Error on the next day's closing price was used to determine the best model.

In the chart, we display the model's predictions for last split of cross validation and test data.

  1. train: Training data of the last split.
  2. validation: Validation data of the last split.
  3. prediction (train, validation): Prdiction for train and validation data period. For each row (or a sliding window) of data, predictions are made for n days into the future (where n is set to 1, 2, 7). The predictions are then combined into a single series of dots. Since the accuracy of predictions decreases for large n, we see some hiccups in the predictions. The predictions from the tail of the train spills into the validation period as that's future from the 'train' data period viewpoint. These are somewhat peculiar settings, but it works well in testing if the model's predictions are good enough.
  4. test(input): Test input data.
  5. test(actual): Test actual data.
  6. prediction(test): The model's prediction given the test input. There's only one prediction from the last row (or the last sliding window) of the test input which corresponds to 1, 2, 7 days later after 'test(input)'.