Repository navigation
fix: correct centering and sample distinct negative windows - #188
Merged
Merged
Conversation
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.
Stacked on #185 so this PR includes the shared CI prerequisites. Review/merge #185 first, then retarget this PR to
main.center_examples=Truecurrently selects uncentered windows, contrary to its documentation. Correct the branch and set the default to False so the default behavior stays uncentered. Explicit values in old configurations change meaning: invert them to reproduce previous behavior. Explicit centering still introduces a position prior for simulation scores.Sample random negative windows without replacement using a local Torch generator. Keep candidate indices one-dimensional when exactly one negative window exists. Construct zero activations as floats, correct centered-window tensor annotations, and preserve input dtypes for empty centered results so runtime type checking accepts valid inputs.
Validation: nine constructor regressions pass independently with pytest-beartype enabled, covering actual peak offsets, the branch selection, empty centered windows, a single negative, distinct negatives, and preservation of the global Torch RNG. The combined fixes pass 49 focused tests; Ruff passes. These are CPU tests without model downloads; the full cache/model integration suite was not run.
The existing main-branch collection failure is fixed separately by #185.