-
-
Notifications
You must be signed in to change notification settings - Fork 49
Resolving issue #260 ( added exogenous variables to Chronos-2 ) #264
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
84c8e90
e145719
5bf21a1
2145a23
bca1df1
85f25fb
36e628f
087b3aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,6 +84,7 @@ def __init__( | |||||||||||
| self.repo_id = repo_id | ||||||||||||
| self.batch_size = batch_size | ||||||||||||
| self.alias = alias | ||||||||||||
| self.supports_exogenous = "chronos-2" in repo_id | ||||||||||||
|
|
||||||||||||
| @contextmanager | ||||||||||||
| def _get_model(self) -> BaseChronosPipeline: | ||||||||||||
|
|
@@ -161,6 +162,76 @@ def _predict( | |||||||||||
| fcsts_mean_np = fcsts_mean.numpy() # type: ignore | ||||||||||||
| fcsts_quantiles_np = None | ||||||||||||
| return fcsts_mean_np, fcsts_quantiles_np | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def _forecast_chronos2_df( | ||||||||||||
| self, | ||||||||||||
| df: pd.DataFrame, | ||||||||||||
| h: int, | ||||||||||||
| freq: str | None, | ||||||||||||
| qc: QuantileConverter, | ||||||||||||
| ) -> pd.DataFrame: | ||||||||||||
|
|
||||||||||||
| id_col = "unique_id" | ||||||||||||
| ts_col = "ds" | ||||||||||||
| target_col = "y" | ||||||||||||
|
|
||||||||||||
| required = {id_col, ts_col, target_col} | ||||||||||||
| if not required.issubset(df.columns): | ||||||||||||
| raise ValueError("missing required columns") | ||||||||||||
|
||||||||||||
| raise ValueError("missing required columns") | |
| missing = required - set(df.columns) | |
| raise ValueError(f"Missing required columns: {missing}") |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This loop can be simplified using a list comprehension: exog_cols = [col for col in df.columns if col not in base_cols]
| exog_cols = [] | |
| for col in df.columns: | |
| if col not in base_cols: | |
| exog_cols.append(col) | |
| exog_cols = [col for col in df.columns if col not in base_cols] |
Kushagra7777 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message should mention the source and available columns for debugging. Consider: raise ValueError(f'predictions column missing from model output. Available columns: {list(pred_df.columns)}')
| raise ValueError("predictions column missing") | |
| raise ValueError(f"predictions column missing from model output. Available columns: {list(pred_df.columns)}") |
Kushagra7777 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Kushagra7777 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -251,10 +251,15 @@ def cross_validation( | |||
| freq=pd.tseries.frequencies.to_offset(freq), | ||||
| step_size=h if step_size is None else step_size, | ||||
| ) | ||||
| supports_exogenous = getattr(self, "supports_exogenous", False) | ||||
| for _, (cutoffs, train, valid) in tqdm(enumerate(splits)): | ||||
| if len(valid.columns) > 3: | ||||
|
|
||||
|
||||
Uh oh!
There was an error while loading. Please reload this page.