mlforecast
mlforecast copied to clipboard
Lag transforms on different levels of aggregation
Discussed in https://github.com/Nixtla/mlforecast/discussions/192
Originally posted by elisevansartefact August 30, 2023 If I want to use lags of y for each unique_id, and lag transformations such as rolling mean per unique_id, this is easy enough to do:
MLForecast(models = [MODELS], lags = [1, 2], lag_transforms={1: [(rolling_mean, 4)]})
However, in order to include insights about the global trend, what if I want to include features which are transformations of the lags of every unique_id (not just one unique_id)?
For instance, what if I want to include the 4-week rolling mean of the sum of y for every unique_id? Or the mean of all the y_lag1 for each unique_id?
I suppose that this can be done via MLForecast.preprocess, however perhaps I am missing an easier way, and if not, perhaps a global_lag_transforms could be added in future as a parameter of MLForecast?