Zac Pullar-Strecker
02/24/2025, 8:37 PMinsample_y
), but I assume there's a decent amount in the nf/dataset/loss side that would need to be modified to support multiple targets as well.
I guess I'd love to hear how difficult you think this modification would be and any tips for diving into it.Olivier
02/24/2025, 8:44 PMZac Pullar-Strecker
02/24/2025, 8:49 PMOlivier
02/24/2025, 8:58 PMOlivier
02/24/2025, 8:58 PMZac Pullar-Strecker
02/25/2025, 3:34 AMimport pandas as pd
from neuralforecast.models.tsmixerx import TSMixerx
from neuralforecast import NeuralForecast
nf = NeuralForecast([TSMixerx(
h=24,
input_size=48,
n_series=69,
revin=False,
batch_size=32,
hist_exog_list=['ex_0', 'ex_1', 'ex_2', 'ex_3', 'ex_4', 'ex_5', 'ex_6', 'ex_7', 'ex_8', 'ex_9', 'ex_10', 'ex_11', 'ex_12', 'ex_13', 'ex_14', 'ex_15', 'ex_16', 'ex_17', 'ex_18', 'ex_19', 'ex_20', 'ex_21', 'ex_22', 'ex_23', 'ex_24', 'ex_25', 'ex_26', 'ex_27', 'ex_28', 'ex_29', 'ex_30', 'ex_31', 'ex_32', 'ex_33', 'ex_34', 'ex_35', 'ex_36', 'ex_37', 'ex_38', 'ex_39', 'ex_40', 'ex_41', 'ex_42', 'ex_43', 'ex_44', 'ex_45', 'ex_46', 'ex_47', 'ex_48', 'ex_49', 'ex_50', 'ex_51', 'ex_52', 'ex_53', 'ex_54', 'ex_55', 'ex_56', 'ex_57', 'ex_58', 'ex_59', 'ex_60', 'ex_61', 'ex_62', 'ex_63', 'ex_64', 'ex_65', 'ex_66', 'ex_67']
)], freq="h",)
nf.fit(
pd.read_parquet("anon_frame.parquet")
)
Where anon_frame.parquet is: https://drive.google.com/file/d/128OgJqbbWZGeOoW1DcBInBEykaO9zCIK/view?usp=sharing.
I traced this back to train_step getting a batch arg with a reduced n_series dimension, but I'm not sure why that's happening.Olivier
02/25/2025, 5:06 PMOlivier
02/25/2025, 5:07 PMZac Pullar-Strecker
02/25/2025, 7:51 PMOlivier
02/25/2025, 8:00 PMZac Pullar-Strecker
02/25/2025, 8:50 PMZac Pullar-Strecker
02/25/2025, 8:51 PMOlivier
02/26/2025, 3:31 PMdf = pd.read_parquet("tmp/anon_frame.parquet").reset_index(drop=True)
column_names = [f"series_{i}" for i in range(69)] + ["run_id", "ds"]
df.columns = column_names
df = df.set_index(["run_id", "ds"]).stack().reset_index()
df.columns = ["run_id", "ds", "unique_id", "y"]
df["run_id"] = df["run_id"].astype(int)
df = df.sort_values(by=["run_id", "unique_id", "ds"]).reset_index(drop=True)
df = df.drop_duplicates(subset=["unique_id", "ds"])
df_test = df.groupby(["unique_id"]).tail(24)
df_train = df.drop(df_test.index).reset_index(drop=True)
df_test = df_test.reset_index(drop=True)
nf = NeuralForecast([TSMixerx(
h=24,
input_size=48,
n_series=69,
revin=True,
batch_size=69,
futr_exog_list=["run_id"],
max_steps=10,
)], freq="h")
nf.fit(df_train)
df_pred = nf.predict(futr_df=df_test.drop(["y"], axis=1))
Olivier
02/26/2025, 3:31 PMOlivier
02/26/2025, 4:32 PMZac Pullar-Strecker
02/26/2025, 7:36 PMOlivier
02/26/2025, 8:49 PMfutr_exog_list
out and drop futr_df
from the predict call