FIX Covariates: enforce length invariant, fix slice() indexing#49
Open
felixdivo wants to merge 1 commit into
Open
FIX Covariates: enforce length invariant, fix slice() indexing#49felixdivo wants to merge 1 commit into
felixdivo wants to merge 1 commit into
Conversation
Covariates fields now default to None (explicit "absent for every series") instead of empty lists, so the length invariant can always hold without boilerplate: each field is either None or has one entry per series (len(x)). - ForecastInput.__post_init__ now validates each present covariate field has length len(x) (resolves the disabled TODO). - Covariates.__post_init__ validates non-None fields share one length, fixing a chained-comparison bug (a != b != c) that silently skipped checks. - slice() now takes series_idx and slices the time axis of the selected series, instead of incorrectly slicing the series axis; updated the sole caller in BaseTSFMSolver.forecast. - Enedis drops the redundant static_covars=[]; docstrings updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
CI Needs #50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covariatesfields defaulted to empty lists, solen(covariates) == 0whilelen(x) == N— which is why the length check inForecastInputwas disabled(it would fire for every covariate-free dataset).
Now each field defaults to
None("absent for every series"), so the invariantholds without boilerplate: a field is either
Noneor has one entry per series.ForecastInput.__post_init__: covariates must be absent (len 0) or cover everyseries (len(x)).
Covariates.__post_init__: present fields must share one length — fixes achained-comparison bug (
a != b != c) that silently skipped the check.slice()now takesseries_idxand slices the time axis of the selectedseries, instead of slicing the series axis; updated the sole caller.
static_covars=[]; docstrings updated.Leakage tests pass; the pre-existing encoder-shape test failures are unrelated.