Matej10/05/2023, 5:21 PM
José Morales10/05/2023, 5:27 PM
. Something like:
df = df.sort_values([id_col, time_col]) daytime_df = df[df[time_col].dt.hour.between(hour_start, hour_end)]].copy() daytime_df[time_col] = daytime_df.groupby(id_col).cumcount() fcst = MLForecast(freq=1, ...)
Matej10/05/2023, 5:27 PM
meaning if there are no lags none will be added for that particular timestep ?
freq = '15T', target_transforms = [LocalStandardScaler()], lags = np.arange(1, 10).tolist()
José Morales10/05/2023, 5:34 PM
Matej10/05/2023, 5:36 PM
but this behaviour you explained makes sense as well.
I have timesteps: 1 - 12 then 12 - 24 are missing and hence 25 th timestep wont have lag_1.
José Morales10/05/2023, 5:39 PM
time value lag1 11 1 nan 12 2 1 24 3 2 25 4 3
Matej10/06/2023, 8:16 PM
José Morales10/06/2023, 8:20 PM
Matej10/07/2023, 5:55 AM
• interestingly, this "sparse" timestep works in MLforecast.fit method, but not in predict or in cross_validate. • in predict, I obviously have to provide X_df for all the timesteps for the specified horizon • Example: I cant specify horizon h = 3 with the df_test from the screenshot, I can specify h = 2. timestep has to become
ds = 1 ... 18,28,29,30, ...
• which means that I am currently trying to do seasonal transformations and lags before removing the night • then I recreate the freq=1 index using np.arange to be consistent and hence dataset is usable in the predict and cv methods. • But perhaps it is all way more simple and I am just approaching it wrong 😄
ds = 1 ... 18,19,20,21, ...
José Morales10/10/2023, 3:21 PM