This library was created to make a numpyro-based Prophet model for timeseries forecasting, allowing the user to provide custom priors for specific groups of exogenous variables. In addition, it offers a multivariate implementation for hierarchical forecasting, with potentially shared coefficients between timeseries. All implementations (hierarchical and univariate) are based on sktime interface.
The idea was not to fully reproduce Prophet, but to provide an extension with some extra features.
✅ Univariate and multivariate forecasting
✅ Custom prior distributions for exogenous variables
✅ Non-linear effects for exogenous variables (one may create custom effects inheriting AbstractEffect class)
✅ Shared coefficients between timeseries (multi-variate model)
✅ Sktime interface
✅ Capacity parameter of logistic trend as a random variable
✅ MCMC and MAP inference
To install with pip:
pip install prophetverse
Or with poetry:
poetry add prophetverse
The main differences with the original Prophet model are:
- The logistic version of the trend. In the original paper, the logistic growth is:
where
which are equivalent. The priors for those parameters
- The capacity is also modelled as a random variable, and it's assumed constant. The user can pass the capacity prior as a parameter.
- One can set different prior distributions for the parameters of the model. The parameters also may be different for different groups of variables, which allows to force positive coefficients for some groups and not for others (with HalfNormal prior, for example).
- Changepoint interval is used instead of changepoint number. Motivation: as the timeseries evolve, a given changepoint number may have different meanings. For example, a changepoint number of 10 may be too much for a series with 100 observations, but too little for a series with 1000 observations. The changepoint interval may avoid this problem.
- The exogenous variable inputs are not scaled. They should be scaled prior to the model fitting, with sktime transfomers for example.
- The fourier terms for seasonality must be passed as exogenous variables in
feature_transformer
argument.
For the hierarchical model, the forecast is done in a bottom-up fashion. All series parameters are infered simultaneously, and a multivariate normal likelihood is used (LKJ prior for the correlation matrix). In the future, forecasts with OLS reconciliation may be implemented.