ProphetWrapper is a package wrapping Facebook's Prophet R Package for Time-Series Forecasting. The main rationale behind the package was to build a reproducible function to train and test several models simultaneously. It allows the user to define a train/test split and evaluate the models produced under different scenarios with several error-metrics.


```{r eval=FALSE} devtools::install_github("joaocunha1991/ProphetWrapper")


## How to use it

Below you can find a simple example of how to explore the functionality of ProphetWrapper. The package contains only one function ProphetWrapper::Prophet_Wrapper().

```{r eval=FALSE}


parameters_model = list(changepoint.prior.scale =  c(0.001, 0.003, 0.005, 0.01, 0.03, 0.05, 0.08, 0.1, 0.15),
                        holidays.prior.scale = c(1, 3, 6, 10, 13, 15, 25),
                        regressor.prior.scale = c(0.05),
                        weekly.seasonality = TRUE,
                        yearly.seasonality = TRUE,
                        standardize_regressor = TRUE,
                        log_transformation = TRUE,
                        target_variable = "sessions",
                        regressor1 = c("no_regressor"),
                        regressor2 = c("no_regressor"))

prophetWrapper_output = ProphetWrapper::Prophet_Wrapper(df = df_model,
                                                        list_params = parameters_model,
                                                        best_model_in = "test",
                                                        main_accuracy_metric = "MAPE",
                                                        plotFrom = "2017-01-01",
                                                        seed = 11111,
                                                        debug = FALSE)

The sessions dataset is a time-series data-frame with the daily volumes of sessions for an imaginary website between 2013-01-01 and 2017-01-09. In the example above, we first create a 'parameters_model' list with some important options/parameters to be parsed to the Prophet_Wrapper function. changepoint.prior.scale, regressor.prior.scale and holidays.prior.scale can be treated as a grid of parameters that is going to be iterated over the modeling process.

The example runs 63 models (9 changepoint.prior.scale times 7 holidays.prior.scale times 1 regressor.prior.scale values) with weekly and yearly seasonality and the target variable is log transformed. The current example doesn't use external regressors but it's possible to iterate over two groups of regressors (regressor1 and regressor2). The best model is selected based on the MAPE ('main_accuracy_metric' parameter) on the test set ('best_model_in' parameter). 'debug' when set to TRUE can be used for debugging.

Prophet documentation is very reach and provides extra information on the some of the parameters used on ProphetWrapper. The following resources can be useful:

Output of Prophet_Wrapper

The output of Prophet_Wrapper is an R list containing:

joaocunha1991/ProphetWrapper documentation built on June 25, 2018, 12:02 a.m.