Forecaster
ProphetPiecewiseLinearTrendForecaster
Forecast time series data with a piecewise linear trend, fitted via prophet.
Quickstart
python
from sktime.forecasting.trend import ProphetPiecewiseLinearTrendForecaster
estimator = ProphetPiecewiseLinearTrendForecaster(changepoints=None, n_changepoints=25, changepoint_range=0.8, changepoint_prior_scale=0.05, verbose=0, yearly_seasonality=False, weekly_seasonality=False, daily_seasonality=False)Parameters(7)
- changepoints: list or None, default=None
- List of dates at which to include potential changepoints. If not specified, potential changepoints are selected automatically.
- n_changepoints: int, default=25
Number of potential changepoints to include. Not used if input
changepointsis supplied. Ifchangepointsis not supplied, then n_changepoints potential changepoints are selected uniformly from the firstchangepoint_rangeproportion of the history.- changepoint_range: float, default=0.8
Proportion of history in which trend changepoints will be estimated. Defaults to 0.8 for the first 80%. Not used if
changepointsis specified.- changepoint_prior_scale: float, default=0.05
- Parameter modulating the flexibility of the automatic changepoint selection. Large values will allow many changepoints, small values will allow few changepoints. Recommended to take values within [0.001,0.5].
- yearly_seasonality: str or bool or int, default=False
- Include yearly seasonality in the model. “auto” for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series.
- weekly_seasonality: str or bool or int, default=False
- Include weekly seasonality in the model. “auto” for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series.
- daily_seasonality: str or bool or int, default=False
- Include weekly seasonality in the model. “auto” for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series.
Examples
>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.trend import ProphetPiecewiseLinearTrendForecaster
>>> from sktime.forecasting.base import ForecastingHorizon
>>> from sktime.split import temporal_train_test_split
>>> y = load_airline (). to_timestamp (freq = 'M')
>>> y_train, y_test = temporal_train_test_split (y)
>>> fh = ForecastingHorizon (y. index, is_relative = False)
>>> forecaster = ProphetPiecewiseLinearTrendForecaster ()
>>> forecaster. fit (y_train) ProphetPiecewiseLinearTrendForecaster(
... )
>>> y_pred = forecaster. predict (fh)References
- [1 ] https://facebook.github.io/prophet