The core.NeuralForecast
class allows you to efficiently fit multiple NeuralForecast
models for large sets of time series. It operates with pandas DataFrame df
that identifies individual series and datestamps with the unique_id
and ds
columns, and the y
column denotes the target time series variable. To assist development, we declare useful datasets that we use throughout all NeuralForecast
’s unit tests.
*Generate Synthetic Panel Series.
Generates n_series
of frequency freq
of different lengths in the
interval [min_length
, max_length
]. If n_temporal_features > 0
,
then each serie gets temporal features with random values. If
n_static_features > 0
, then a static dataframe is returned along the
temporal dataframe. If equal_ends == True
then all series end at the
same date.
Parameters:
n_series
: int, number of series for synthetic
panel.
min_length
: int, minimal length of synthetic panel’s
series.
max_length
: int, minimal length of synthetic panel’s
series.
n_temporal_features
: int, default=0, number of temporal
exogenous variables for synthetic panel’s series.
n_static_features
: int, default=0, number of static exogenous
variables for synthetic panel’s series.
equal_ends
: bool, if True,
series finish in the same date stamp ds
.
freq
: str, frequency of
the data, panda’s available
frequencies.
Returns:
freq
: pandas.DataFrame, synthetic panel with columns
[unique_id
, ds
, y
] and exogenous.*
The classic Box & Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
It has been used as a reference on several forecasting libraries, since it is a series that shows clear trends and seasonalities it offers a nice opportunity to quickly showcase a model’s predictions performance.
Extension to classic Box & Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
It includes two series with static, temporal and future exogenous
variables, that can help to explore the performance of models like
NBEATSx
and
TFT
.
We have developed a utility that generates normalized calendar features for use as absolute positional embeddings in Transformer-based models. These embeddings capture seasonal patterns in time series data and can be easily incorporated into the model architecture. Additionally, the features can be used as exogenous variables in other models to inform them of calendar patterns in the data.
*> * Q - [month] > * M - [month] > * W - [Day of month, week of year] > * D - [Day of week, day of month, day of year] > * B - [Day of week, day of month, day of year] > * H - [Hour of day, day of week, day of month, day of year] > * T - [Minute of hour*, hour of day, day of week, day of month, day of year] > * S - [Second of minute, minute of hour, hour of day, day of week, day of month, day of year] minute returns a number from 0-3 corresponding to the 15 minute period it falls into.
Returns a list of time features that will be appropriate for the given frequency string. Parameters ———- freq_str Frequency string of the form [multiple][granularity] such as “12H”, “5min”, “1D” etc.
Week of year encoded as value between [-0.5, 0.5]
Month of year encoded as value between [-0.5, 0.5]
Day of year encoded as value between [-0.5, 0.5]
Day of month encoded as value between [-0.5, 0.5]
Hour of day encoded as value between [-0.5, 0.5]
Hour of day encoded as value between [-0.5, 0.5]
Minute of hour encoded as value between [-0.5, 0.5]
Minute of hour encoded as value between [-0.5, 0.5]
Initialize self. See help(type(self)) for accurate signature.
Class for storing prediction intervals metadata information.
Adds conformal intervals to a fcst_df
based on conformal scores
cs_df
. level
should be already sorted. This strategy creates
forecasts paths based on errors and calculate quantiles using those
paths.
Adds conformal intervals to a fcst_df
based on conformal scores
cs_df
. level
should be already sorted. This startegy creates
prediction intervals based on the absolute errors.
Converts a list of quantiles to a list of levels.
Converts a list of levels to a list of quantiles.
The core.NeuralForecast
class allows you to efficiently fit multiple NeuralForecast
models for large sets of time series. It operates with pandas DataFrame df
that identifies individual series and datestamps with the unique_id
and ds
columns, and the y
column denotes the target time series variable. To assist development, we declare useful datasets that we use throughout all NeuralForecast
’s unit tests.
*Generate Synthetic Panel Series.
Generates n_series
of frequency freq
of different lengths in the
interval [min_length
, max_length
]. If n_temporal_features > 0
,
then each serie gets temporal features with random values. If
n_static_features > 0
, then a static dataframe is returned along the
temporal dataframe. If equal_ends == True
then all series end at the
same date.
Parameters:
n_series
: int, number of series for synthetic
panel.
min_length
: int, minimal length of synthetic panel’s
series.
max_length
: int, minimal length of synthetic panel’s
series.
n_temporal_features
: int, default=0, number of temporal
exogenous variables for synthetic panel’s series.
n_static_features
: int, default=0, number of static exogenous
variables for synthetic panel’s series.
equal_ends
: bool, if True,
series finish in the same date stamp ds
.
freq
: str, frequency of
the data, panda’s available
frequencies.
Returns:
freq
: pandas.DataFrame, synthetic panel with columns
[unique_id
, ds
, y
] and exogenous.*
The classic Box & Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
It has been used as a reference on several forecasting libraries, since it is a series that shows clear trends and seasonalities it offers a nice opportunity to quickly showcase a model’s predictions performance.
Extension to classic Box & Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
It includes two series with static, temporal and future exogenous
variables, that can help to explore the performance of models like
NBEATSx
and
TFT
.
We have developed a utility that generates normalized calendar features for use as absolute positional embeddings in Transformer-based models. These embeddings capture seasonal patterns in time series data and can be easily incorporated into the model architecture. Additionally, the features can be used as exogenous variables in other models to inform them of calendar patterns in the data.
*> * Q - [month] > * M - [month] > * W - [Day of month, week of year] > * D - [Day of week, day of month, day of year] > * B - [Day of week, day of month, day of year] > * H - [Hour of day, day of week, day of month, day of year] > * T - [Minute of hour*, hour of day, day of week, day of month, day of year] > * S - [Second of minute, minute of hour, hour of day, day of week, day of month, day of year] minute returns a number from 0-3 corresponding to the 15 minute period it falls into.
Returns a list of time features that will be appropriate for the given frequency string. Parameters ———- freq_str Frequency string of the form [multiple][granularity] such as “12H”, “5min”, “1D” etc.
Week of year encoded as value between [-0.5, 0.5]
Month of year encoded as value between [-0.5, 0.5]
Day of year encoded as value between [-0.5, 0.5]
Day of month encoded as value between [-0.5, 0.5]
Hour of day encoded as value between [-0.5, 0.5]
Hour of day encoded as value between [-0.5, 0.5]
Minute of hour encoded as value between [-0.5, 0.5]
Minute of hour encoded as value between [-0.5, 0.5]
Initialize self. See help(type(self)) for accurate signature.
Class for storing prediction intervals metadata information.
Adds conformal intervals to a fcst_df
based on conformal scores
cs_df
. level
should be already sorted. This strategy creates
forecasts paths based on errors and calculate quantiles using those
paths.
Adds conformal intervals to a fcst_df
based on conformal scores
cs_df
. level
should be already sorted. This startegy creates
prediction intervals based on the absolute errors.
Converts a list of quantiles to a list of levels.
Converts a list of levels to a list of quantiles.