utilsforecast.feature_engineering
fourier
df
(pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.freq
(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.season_length
(int): Number of observations per unit of time.Ex
: 24 Hourly data.k
(int): Maximum order of the fourier termsh
(int, optional): Forecast horizon. Defaults to 0.id_col
(str, optional): Column that identifies each serie. Defaults to ‘unique_id’.time_col
(str, optional): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.tuple[pandas or polars DataFrame, pandas or polars DataFrame]
: A tuple containing the original DataFrame with the computed features and DataFrame with future values.trend
df
(pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.freq
(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.h
(int, optional): Forecast horizon. Defaults to 0.id_col
(str, optional): Column that identifies each serie. Defaults to ‘unique_id’.time_col
(str, optional): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.tuple[pandas or polars DataFrame, pandas or polars DataFrame]
: A tuple containing the original DataFrame with the computed features and DataFrame with future values.time_features
df
(pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.freq
(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.features
(list of str or callable): Features to compute. Can be string aliases of timestamp attributes or functions to apply to the times.h
(int, optional): Forecast horizon. Defaults to 0.id_col
(str, optional): Column that identifies each serie. Defaults to ‘unique_id’.time_col
(str, optional): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.tuple[pandas or polars DataFrame, pandas or polars DataFrame]
: A tuple containing the original DataFrame with the computed features and DataFrame with future values.future_exog_to_historic
h
steps.
Args:
df
(pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.freq
(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.features
(list of str): Features to be converted into historic.h
(int, optional): Forecast horizon. Defaults to 0.id_col
(str, optional): Column that identifies each serie. Defaults to ‘unique_id’.time_col
(str, optional): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.tuple[pandas or polars DataFrame, pandas or polars DataFrame]
: A tuple containing the original DataFrame with the computed features and DataFrame with future values.pipeline
df
(pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.features
(list of callable): List of features to compute. Must take only df, freq, h, id_col and time_col (other arguments must be fixed).freq
(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.h
(int, optional): Forecast horizon. Defaults to 0.id_col
(str, optional): Column that identifies each serie. Defaults to ‘unique_id’.time_col
(str, optional): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.tuple[pandas or polars DataFrame, pandas or polars DataFrame]
: A tuple containing the original DataFrame with the computed features and DataFrame with future values.