Slackbot
10/05/2023, 5:21 PMJosé Morales
10/05/2023, 5:27 PMfreq=1
. 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, ...)
Matej
10/05/2023, 5:27 PMMatej
10/05/2023, 5:32 PMfreq = '15T',
target_transforms = [LocalStandardScaler()],
lags = np.arange(1, 10).tolist()
meaning if there are no lags none will be added for that particular timestep ?Matej
10/05/2023, 5:32 PMJosé Morales
10/05/2023, 5:34 PMMatej
10/05/2023, 5:36 PMI have timesteps:
1 - 12
then
12 - 24
are missing
and hence
25 th timestep wont have lag_1.
but this behaviour you explained makes sense as well.José Morales
10/05/2023, 5:39 PMtime value lag1
11 1 nan
12 2 1
24 3 2
25 4 3
Matej
10/06/2023, 8:16 PMJosé Morales
10/06/2023, 8:20 PMMatej
10/07/2023, 5:55 AMds = 1 ... 18,28,29,30, ...
• 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,19,20,21, ...
• 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 😄José Morales
10/10/2023, 3:21 PMJosé Morales
10/10/2023, 3:22 PM