DianaZaig / Nowcasting-Techsprint

0 stars 0 forks source link

name 'y_freq' is not defined #4

Open jquibla opened 2 weeks ago

jquibla commented 2 weeks ago

In the TechSprint_II_TFT notebook, after pivotting the tables and including just one institution as the "y" in the tft.fit() function, I'm getting the "name 'y_freq' is not defined".

The code for the function is: tft.fit( X={"W": df_weekly_train, "ME": df_monthly_train}, y={"W": dict_df_y_train['B5413']} )

If I change it to this (change the "y" frequency to ME): tft.fit( X={"W": df_weekly_train, "ME": df_monthly_train}, y={"ME": dict_df_y_train['B5413']} )

The error changes to "Shape of sample (1178,) of sequence at position 1 is different from expected shape (1,)"

dkgaraujo commented 2 weeks ago

Thank you @jquibla - what is the actual frequency of the df_y_train data?

jquibla commented 2 weeks ago

It's weekly, although I've seen some dates that are not separated by a whole week.

dkgaraujo commented 2 weeks ago

This could be a reason, for example if pandas would see it as daily.

dkgaraujo commented 2 weeks ago

I'll try tomorrow with your data - if it doesn't work, we can always resample it to daily, like so:

daily_y = df_y_train.resample("D").bfill()

Another approach we can explore is to cast it to a weekly frequency - and on top of it, use a "unified frequency" dataset (as in the original TFT) with one row per week.