module mlforecast.feature_engineering


function transform_exog

transform_exog(
    df: DataFrame,
    lags: Optional[Iterable[int]] = None,
    lag_transforms: Optional[Dict[int, List[Union[Callable, Tuple[Callable, Any]]]]] = None,
    id_col: str = 'unique_id',
    time_col: str = 'ds',
    num_threads: int = 1
) → DataFrame
Compute lag features for dynamic exogenous regressors. Args:
  • df (pandas or polars DataFrame): Dataframe with ids, times and values for the exogenous regressors.
  • lags (list of int, optional): Lags of the target to use as features. Defaults to None.
  • lag_transforms (dict of int to list of functions, optional): Mapping of target lags to their transformations. Defaults to None.
  • id_col (str): Column that identifies each serie. Defaults to ‘unique_id’.
  • time_col (str): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.
  • num_threads (int): Number of threads to use when computing the features. Defaults to 1.
Returns:
  • (pandas or polars DataFrame): Original DataFrame with the computed features