Hakan Ateşli
08/20/2024, 8:06 AMfcst = MLForecast(
models=[LGBMRegressor(verbosity = -1), XGBRegressor(random_state=0, n_estimators=100)],
freq="MS",
lags=[1, 2, 3, 4, 5, 6, 12],
lag_transforms = {
1: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6),Combine(
RollingMean(window_size=3),
RollingMean(window_size=12),
operator.truediv,
)],
6: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6),Combine(
RollingMean(window_size=3),
RollingMean(window_size=12),
operator.truediv,
)],
12: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6)]
},
date_features = ["year", "month", "quarter", month_sin_transform, month_cos_transform, quarter_sin_transform,
quarter_cos_transform, is_summer, is_winter, is_fall, is_spring, is_first_month, is_last_month],
target_transforms=[GlobalSklearnTransformer(sk_log1p)],
num_threads=8
)
When I create the MLForecast object as above, I get the following error.
However, when I remove the Combine features, I do not get any error.
fcst = MLForecast(
models=[LGBMRegressor(verbosity = -1), XGBRegressor(random_state=0, n_estimators=100)],
freq="MS",
lags=[1, 2, 3, 4, 5, 6, 12],
lag_transforms = {
1: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6)],
6: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6)],
12: [RollingMean(3), RollingMean(6), RollingMin(6), RollingMax(6), RollingStd(6)]
},
date_features = ["year", "month", "quarter", month_sin_transform, month_cos_transform, quarter_sin_transform,
quarter_cos_transform, is_summer, is_winter, is_fall, is_spring, is_first_month, is_last_month],
target_transforms=[GlobalSklearnTransformer(sk_log1p)],
num_threads=8
)
How can the feature I created with Combine cause this error? Can you help me? I can share the notebook if you want.José Morales
08/20/2024, 6:21 PMHakan Ateşli
08/21/2024, 6:39 AMHakan Ateşli
08/21/2024, 6:41 AMfcst.fit(df_train,
fitted=True,
static_features=[])
Y_hat_df = fcst.predict(horizon).set_index('unique_id')
Y_fitted_df = fcst.forecast_fitted_values()
reconcilers = [BottomUp(),
MinTrace(method='ols'),
MinTrace(method='mint_shrink')]
hrec = HierarchicalReconciliation(reconcilers=reconcilers)
Y_rec_df = hrec.reconcile(Y_hat_df=Y_hat_df,
Y_df=Y_fitted_df,
S=S_df,
tags=tags)
José Morales
08/21/2024, 3:58 PMdescribe()
on the predictions or plot some histograms to see if their distributions are very different?Hakan Ateşli
08/21/2024, 4:09 PMJosé Morales
08/21/2024, 4:14 PMHakan Ateşli
08/21/2024, 6:16 PMOlivier
02/21/2025, 2:24 PM