Skip to content

fix: correct centering and sample distinct negative windows - #188

Merged
SrGonao merged 2 commits into
mainfrom
fix/constructor-window-sampling
Nov 2, 2026
Merged

SrGonao merged 2 commits into
mainfrom
fix/constructor-window-sampling

Conversation

@SrGonao

@SrGonao SrGonao commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #185 so this PR includes the shared CI prerequisites. Review/merge #185 first, then retarget this PR to main.

center_examples=True currently 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.

@SrGonao
SrGonao changed the base branch from main to fix/ci-module-cache-isolation November 1, 2026 14:52
@SrGonao
SrGonao changed the base branch from fix/ci-module-cache-isolation to main November 2, 2026 12:40
@SrGonao
SrGonao merged commit fd06aea into main Nov 2, 2026
4 checks passed
@SrGonao
SrGonao deleted the fix/constructor-window-sampling branch November 2, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant