Repository navigation
fix: empty-window encoding and exact Fréchet; run-2 pre-registration Amendment 2 - #14
Merged
Merged
Conversation
A window with no detection in any frame is fully masked; PyTorch's inference fast path raised "to_padded_tensor: at least one constituent tensor should have non-zero numel" (windows are encoded one at a time), and training-mode attention is undefined there. Unmask fully missing windows; masked_mean_pool already discards their frame outputs, so all empty windows map to one "nothing detected" summary. Found by the run-2 blind test; regression test reproduces the exact error on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ovariance The trace term took sqrtm of the non-symmetric product and raised when imag/real exceeded 1e-3. With a zero (shrunk) covariance the real part is ~1e-12, so the test divided by ~zero although the distance is exactly ||mu_a - mu_b||^2 + tr(Sigma_a). Use tr((Sb^1/2 Sa Sb^1/2)^1/2) = sum sqrt(eig), clipped at zero: exact, no free parameter, stable for singular and near-singular covariances. Matches sqrtm on well-conditioned data to 1e-9; V2's published values reproduce exactly. Spec 7.1 deviation documented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… output Amendment 2 (2026-10-09, before any run-2 data), prompted by the pre-registered blind test: symmetric Frechet (section 7.1); Rules A and B also computed without conditions whose landmark error is undefined, reported with equal prominence, no single verdict if they disagree; per-take breakdown for every condition; present-frames-only gap not computable below 3 windows; blind-test outcome recorded. The analysis script implements both analyses and prints the per-take table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Two fixes found by the pre-registered blind test on run 1's footage, plus Amendment 2 to the run-2 pre-registration. Everything here precedes any run-2 recording.
1. Encoder crash on empty windows (
399164e, carried over: PR #13 was merged before this fix was pushed)A window with nothing detected in any frame is fully masked. PyTorch's inference fast path raised
to_padded_tensor: at least one constituent tensor should have non-zero numel, because the analyzer encodes windows one at a time. Such windows are now unmasked; presence-weighted pooling already discards their frame outputs, so every empty window maps to one "nothing detected" summary. A regression test reproduces the exact error on the old code.2. Fréchet safeguard misfire (
d326435)noise_32in the blind test), all latents are identical and the shrunk covariance is zero. The old ratio test, imag/real > 1e-3 onsqrtm(Σ_A Σ_B), then divided by about 1e-12 and refused, although the distance is exactly ‖μ_A − μ_B‖² + tr(Σ_A).sqrtmon 20 well-conditioned pairs to 1e-9;sqrtm_had_complex_componentis kept for API compatibility and is now alwaysFalse.3. Amendment 2 (
037670a), dated 2026-10-09, before any run-2 data:noiseat std 20, MediaPipe tracked 100% of frames in two takes and never found the body in the third, so pooled means can hide all-or-nothing behaviour. The present-frames-only gap counts as "not computable" below 3 such windows.The analysis script implements both analyses (
rules_all_24,rules_measured_only,rules_disagree) and prints the per-take table.Blind test, after both fixes (run 1's 3 clean takes, 300 frames each, scores discarded unread): every stage passes, with 24 finite gap scores, finite CIs for both rules, the sensitivity analysis, all secondary analyses, 72 per-take rows and the report.
Verification
pytest -q: 192 passed (105 s)ruff check .: clean🤖 Generated with Claude Code