No project description provided
Project description
Prophetverse
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.
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
Installation
To install with pip:
pip install prophetverse
Or with poetry:
poetry add prophetverse
Differences between this Prophet and the original one
The main differences with the original Prophet model are:
- The logistic version of the trend. In the original paper, the logistic growth is:
trend = \frac{C}{1 + \exp(-k(t - m))}
where $C$ is the capacity, $k$ is the growth rate and $m$ is the timeoffset. In this implementation, we implement a similar and equivalent model, but with a different parameterization:
trend = \frac{C}{1 + \exp(-(kt + m'))}
which are equivalent. The priors for those parameters $k$ and $m'$ are chosen in a data driven way, so that they match the maximum and minimum value of the series.
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for prophetverse-0.0.3a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 945c78f8ffefbab2bbe3798fa4836d0c892bcfaabcadd5f6a421868b9c450341 |
|
MD5 | 6ca1123f1b45456454614a84b076e380 |
|
BLAKE2b-256 | 0dc0bae9a0876647f48fbab9de6aa2109c2bced2845029f5399c458bf9730d93 |