Repository navigation
Review #363 (1/19): fix E|X - X'| rounding, acc/bacc y length, RMSE SE diff - #423
Merged
Merged
Conversation
florence-bockting
marked this pull request as ready for review
November 23, 2026 08:36
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## pred_measure #423 +/- ##
================================================
- Coverage 92.03% 91.85% -0.19%
================================================
Files 38 38
Lines 5201 4752 -449
================================================
- Hits 4787 4365 -422
+ Misses 414 387 -27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 8c586dd is merged into pred_measure:
Further explanation regarding interpretation and methodology can be found in the documentation. |
jgabry
requested changes
Nov 23, 2026
jgabry
left a comment
Member
There was a problem hiding this comment.
Looks good just a couple of small suggestions
jgabry
approved these changes
Nov 24, 2026
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.
PR 1/19 for the review of #363.
1.
E|X - X'|is not exactly 0 for constant drawsReview comments: r4544689103, r4544848787
Decision: Use the gap form, as suggested by the reviewer
Implementation:
.exx_pwm()(R/pred_measure-helpers.R): both paths sumdiff(sorted draws)times non-negative coefficients, so constant draws give exactly 0 and the estimate cannot be negative.2 * k * (S - k) / (S * (S - 1)). The reported example (all draws 1,y = 0) takes this path.1 - Cis computed as a sum from the right (rev(cumsum(rev(w)))). This is the same in math. With1 - C, rounding can give about-1e-17at the last gap.measure_rps()(R/pred_measure-builtin.R): theEXX == 0check now works. The error names both causes of a point mass ("all draws equal, or all weight on one draw"). It mentions the PSIS diagnostics only when weights are given.notes/. The formula stays in themeasure_rps()doc. Its "always non-negative" claim is now also true in floating point.Check against the old code: unweighted, the max difference is 0; weighted, 1,000 random cases, the max difference is 4.4e-16.
2.
acc/baccdo not checklength(y)Review comments: r4544794559, r4544798855
Implementation:
.acc_pointwise()(used by both measures) checksncol(mupred) == length(y), as.point_error_from_inputs()does.3. RMSE SE of a difference is 0 if one MSE is 0
Review comment: r4544853232
Implementation:
.se_diff_rmse(): a model with MSE 0 has a constant RMSE of 0, so its term drops out. The result is the SE of the other model's RMSE, the same value thatmeasure_rmse()reports for it. It returns 0 only when both MSE are 0.Tests
In
tests/testthat/test_pred_measure_builtin.R, with small test data:rpsgives exactly|3 - y|, with and without weights.srpserrors, and the PSIS hint appears only with weights.accandbaccerror whenyis too short..se_diff_rmse()with one perfect model equals the RMSE SE of the other model. With two perfect models, it is 0.test_pred_measure_builtin.R,test_pred_measure.R,test_pred_measure_helpers.R,test_print.R,test_crps.Randtest_compare.Rpass. The warnings that are not caught were there before and will be addressed by a later PR.