Repository navigation
Preserve histogram counts during entropy calibration - #2655
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe entropy calibration helper now copies histogram data before modifying its first bin. Regression tests check that repeated calculations preserve collected histogram data and edges, percentile results, and later collection behavior. ChangesEntropy histogram preservation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The histogram copy works for both backends; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Fixes #2654.
What changed
Make the entropy calibration helper copy its input histogram before applying its existing first-bin adjustment. A NumPy slice is a view, so the previous implementation modified the collector's persistent counts. Subsequent percentile/MSE queries and continued collection could then use the altered distribution.
The regression uses the public
HistogramCalibratorwith both histogram backends. It checks unchanged counts and edges, repeated entropy queries, unchanged percentile thresholds, and equivalence with an untouched reference collector after another batch.Validation
79 passed, 1 existing skip on CPU. The focused regression on unchanged upstream gives 1 failure for NumPy histograms and 1 pass for PyTorch histograms. Repository pre-commit checks pass for the changed files.
No new dependencies or public API changes. CUDA execution was not run. This is independent of #2369: its zero-prefix changes affect collection, while this patch changes only the entropy calculation. The changelog is updated.
Summary by CodeRabbit