MLBazaar/MLPrimitives

Accept timedelta window_size in cutoff_window_sequences

csala opened this issue · 0 comments

csala commented

The primitive mlprimitives.custom.timeseries_preprocessing only accepts integers as window_size specification:

https://github.com/HDI-Project/MLPrimitives/blob/a592c8446aa614cd9d0eb6c73735d11ebc876129/mlprimitives/custom/timeseries_preprocessing.py#L216

This should be made flexible, so pd.Timedelta objects or the corresponding str specifications can be passed.

As an example, if an X is passed where the time index has a regular frequency of one hour (so, there are 24 data points every day), all these window_size values should be equivalent:

  • 24
  • '24h'
  • '1d'
  • pd.Timedelta(hours=24)
  • pd.Timedelta(days=1)