Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLForecast+Prediction Intervals+Transfer Learning #456

Open
saad1912 opened this issue Nov 25, 2024 · 0 comments
Open

MLForecast+Prediction Intervals+Transfer Learning #456

saad1912 opened this issue Nov 25, 2024 · 0 comments
Labels

Comments

@saad1912
Copy link

saad1912 commented Nov 25, 2024

What happened + What you expected to happen

I am trying to predict target components over prediction intervals using Transfer Learning approach. But I am getting below error:


ValueError Traceback (most recent call last)
in <cell line: 2>()
1 levels = [20, 75,80, 95]
----> 2 forecasts = mlf.predict(7, level=levels, new_df=df3)
3 forecasts.head()

/usr/local/lib/python3.10/dist-packages/mlforecast/forecast.py in predict(self, h, before_predict_callback, after_predict_callback, new_df, level, X_df, ids)
706 if new_df is not None:
707 if level is not None:
--> 708 raise ValueError(
709 "Prediction intervals are not supported in transfer learning."
710 )

ValueError: Prediction intervals are not supported in transfer learning.
image

Versions / Dependencies

import mlforecast
print(mlforecast.version)

0.15.0

Reproduction script

Y_df_M3, _, _ = M3.load(directory='./', group='Monthly')
models = [lgb.LGBMRegressor(verbosity=-1)]

fcst = MLForecast(
models=models,
lags=range(1, 13),
freq='MS',
target_transforms=[Differences([1, 12])],
)
fcst.fit(Y_df_M3);
Y_df = pd.read_csv('https://datasets-nixtla.s3.amazonaws.com/air-passengers.csv', parse_dates=['ds'])

We define the train df.

Y_train_df = Y_df[Y_df.ds<='1959-12-31'] # 132 train
Y_test_df = Y_df[Y_df.ds>'1959-12-31'] # 12 test

levels = [50, 80, 95]
Y_hat_df = fcst.predict(h=12, level = levels, new_df=Y_train_df)
Y_hat_df.head()


ValueError Traceback (most recent call last)
in <cell line: 2>()
1 levels = [50, 80, 95]
----> 2 Y_hat_df = fcst.predict(h=12, level = levels, new_df=Y_train_df)
3 Y_hat_df.head()

/usr/local/lib/python3.10/dist-packages/mlforecast/forecast.py in predict(self, h, before_predict_callback, after_predict_callback, new_df, level, X_df, ids)
706 if new_df is not None:
707 if level is not None:
--> 708 raise ValueError(
709 "Prediction intervals are not supported in transfer learning."
710 )

ValueError: Prediction intervals are not supported in transfer learning.

Issue Severity

High: It blocks me from completing my task.

@saad1912 saad1912 added the bug label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant