Forecaster
NeuralProphet
NeuralProphet forecaster by wrapping NeuralProphet algorithm [1].
Direct interface to NeuralProphet, using the sktime interface. All hyper-parameters are exposed via the constructor.
Data can be passed in one of the sktime compatible formats. Like Prophet, NeuralProphet also supports integer/range and period index: * integer/range index is interpreted as days since Jan 1, 2000 * PeriodIndex is converted using the pandas method to_timestamp
Schnellstart
python
from sktime.forecasting.neuralprophet import NeuralProphet
estimator = NeuralProphet(freq=None, add_seasonality=None, custom_seasonalities=None, add_country_holidays=None, growth='linear', changepoints=None, n_changepoints=10, changepoints_range=0.8, yearly_seasonality=True, weekly_seasonality=True, daily_seasonality=False, seasonality_mode='additive', seasonality_reg=0, holidays=None, holidays_mode='additive', holidays_reg=0, trend_reg=0, trend_reg_threshold=False, learning_rate=None, epochs=None, batch_size=None, loss_func='Huber', alpha=0.05, uncertainty_samples=1000, verbose=False)Parameter(25)
- freqstr, optional
- Frequency of time series (e.g. ‘D’, ‘M’, etc.)
- add_seasonalitydict, optional
- Additional seasonality component parameters
- custom_seasonalitieslist of dict, optional
- Custom seasonality components
- add_country_holidaysdict, optional
- Country holidays to include
- growthstr, default=”linear”
- Type of trend (‘linear’ or ‘flat’)
- changepointslist, optional
- List of dates for trend changepoints
- n_changepointsint, default=10
- Number of potential trend changepoints
- changepoints_rangefloat, default=0.8
- Proportion of history for changepoints
- yearly_seasonalitybool, default=True
- Whether to include yearly seasonality
- weekly_seasonalitybool, default=True
- Whether to include weekly seasonality
- daily_seasonalitybool, default=False
- Whether to include daily seasonality
- seasonality_modestr, default=”additive”
- How seasonality is combined (‘additive’ or ‘multiplicative’)
- seasonality_regfloat, default=0
- Regularization strength for seasonality
- holidayspd.DataFrame, optional
- Custom holidays DataFrame
- holidays_modestr, default=”additive”
- How holidays are combined (‘additive’ or ‘multiplicative’)
- holidays_regfloat, default=0
- Regularization strength for holidays
- trend_regfloat, default=0
- Regularization strength for trend
- trend_reg_thresholdbool, default=False
- Threshold for trend regularization
- learning_ratefloat, default=None
- Maximum learning rate (applicable in quasi-Newton optimization)
- epochsint, default=None
- Number of training epochs
- batch_sizeint, default=None
- Number of samples per mini-batch
- loss_funcstr, default=”Huber”
- Type of loss to use (e.g., “Huber”, “MSE”, “MAE”, etc.)
- alphafloat, default=0.05
- Width of the uncertainty intervals
- uncertainty_samplesint, default=1000
- Number of samples for estimating uncertainty intervals
- verbosebool, default=False
- Whether to print status information during fitting
Beispiele
>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.neuralprophet import NeuralProphet
>>> # NeuralProphet requires data with a pandas.DatetimeIndex
>>> y = load_airline (). to_timestamp (freq = 'M')
>>> forecaster = NeuralProphet (
... n_changepoints = 0,
... yearly_seasonality = False,
... weekly_seasonality = False,
... daily_seasonality = False,
... epochs = 5,
... uncertainty_samples = 0,
... verbose = False
... )
>>> forecaster. fit (y) NeuralProphet(
... )
>>> y_pred = forecaster. predict (fh = [1, 2, 3 ])