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

fix level check for restricting input in forecast #265

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions nbs/timegpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,12 @@
" # - we dont have exogenous regegressors\n",
" # - and we dont want to produce pred intervals\n",
" # - no add history\n",
" restrict_input = self.fewshot_steps == 0 and X_df is None and self.level is not None and not add_history\n",
" restrict_input = (\n",
" self.fewshot_steps == 0\n",
" and X_df is None\n",
" and self.level is None\n",
" and not add_history\n",
" )\n",
" if restrict_input:\n",
" # add sufficient info to compute\n",
" # conformal interval\n",
Expand Down Expand Up @@ -1678,11 +1683,11 @@
"test_warns(\n",
" lambda: timegpt.forecast(df_test, finetune_steps=2, h=12, model=\"timegpt-1-long-horizon\"),\n",
")\n",
"test_eq(\n",
"pd.testing.assert_frame_equal(\n",
" timegpt.forecast(df_test, h=12, model=\"timegpt-1\"),\n",
" timegpt.forecast(df_test, h=12),\n",
")\n",
"test_eq(\n",
"pd.testing.assert_frame_equal(\n",
" timegpt.forecast(df_test, h=12, model=\"timegpt-1-long-horizon\"),\n",
" timegpt.forecast(df_test, h=12, model=\"long-horizon\"),\n",
")"
Expand Down
2 changes: 1 addition & 1 deletion nixtlats/timegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def forecast(
restrict_input = (
self.fewshot_steps == 0
and X_df is None
and self.level is not None
and self.level is None
and not add_history
)
if restrict_input:
Expand Down
Loading