fix: DailyBatchSampler yields per-day cross-sections instead of contiguous slices - #2342
Open
tongflau-dongzhu wants to merge 2 commits into
Open
Conversation
…guous slices TSDataSampler rows are physically instrument-major (<instrument, datetime>); get_index() swaps the label order only, so one trading day's rows are not contiguous. The old code sliced np.arange(idx, idx + count) by per-day counts, producing batches that span several trading days of one instrument and drop the other instruments for those days. Compute each day's actual row positions via groupby over the datetime level and document the row-order contract on get_index(). Fixes microsoft#2319
Author
|
@microsoft-github-policy-service agree |
…e (get_index returns swapped view) - DailyBatchSampler exposes index_order (physical rows in iteration order) - GATs.predict aligns predictions via get_index()[index_order] — previously it assumed instrument-major iteration, which the sampler no longer does - test fixture mirrors real get_index() (swaplevel view over instrument-major rows); groupby(level=0) now groups by datetime as intended Addresses review feedback on microsoft#2319 / PR microsoft#2342.
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.
Implements the fix discussed in #2319.
What changed
p.arange(idx, idx + count)) under the false assumption that one day's rows are contiguous.
Verification
Fixes #2319