Interpreting the result of the prophet for the weekly and seasonal seasons

I am reading a tutorial for use prophet

in R.

You can find the dataset here: https://github.com/facebookincubator/prophet/blob/master/examples/example_wp_peyton_manning.csv

# R
library(prophet)
library(dplyr)

df <- read.csv('peyton.csv') %>%
  mutate(y = log(y))

head(df)

          ds        y
1 2007-12-10 9.590761
2 2007-12-11 8.519590
3 2007-12-12 8.183677
4 2007-12-13 8.072467
5 2007-12-14 7.893572
6 2007-12-15 7.783641

df$ds<-as.Date(df$ds,'%m/%d/%Y')

m <- prophet(df)

future <- make_future_dataframe(m, periods = 365)

forecast <- predict(m, future)

plot(m, forecast)

prophet_plot_components(m, forecast)

      

The result for prophet_plot_components (m, forecast) is below:

enter image description here

I interpret this graph for the annual part of seasonality as:

Regardless of your forecast for a specific date, increase or decrease it by the so-called amount to take into account the annual seasonality? For example, it looks like y is expected to be -0.5 on April 1st. How to use this result? Am I taking the average of y over the year and subtracting it by -0.5 to account for seasonality? Suddenly confused.

Any help would be great!

+3


source to share


1 answer


@Nick The prophet predict () function has the following syntax:

temp_dataframe_to_store_prediction <- predict(model_name, new_dataframe_created)

      

In your case:

forecast <- predict(m, future)

      



The forecasts or forecasts of the pred () function include the trend and seasonality for each row, that is, for each time_stamp. Therefore, you do not need to include any separate line of code to include or exclude seasonality in the final forecast values. Your interpretation is correct, that is, the final forecast values ​​are achieved by adding (+/-) the seasonality and trend values ​​to the stationary "y" value. Note that the "y" value used by the prophet in your code is log (original_y)

 mutate(y = log(y))

      

This line makes the original value unchanged. Therefore, to interpret the final results, you need to take the exponent of the predicted "y" value. This brings the forecast back to its original scale. It is not necessary to accept exponential values ​​if original_y has not been converted.

0


source







All Articles