Repository navigation
Use posterior::is_constant() instead of a copy in loo - #433
florence-bockting merged 2 commits into
Conversation
loo kept its own is_constant() with a tolerance relative to the magnitude of x (stan-dev#407). posterior 1.8.0 has the same function (stan-dev/posterior#469), so loo now uses posterior::is_constant() and requires posterior >= 1.8.0. With an older posterior the absolute tolerance would come back. The skip in the E_loo scale test is no longer needed, so the test always runs. Part of stan-dev#408 Signed-off-by: Soujas K <kudchadkarsoujas@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #433 +/- ##
==========================================
- Coverage 92.82% 92.81% -0.01%
==========================================
Files 31 31
Lines 3078 3075 -3
==========================================
- Hits 2857 2854 -3
Misses 221 221 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 4964f94 is merged into master:
Further explanation regarding interpretation and methodology can be found in the documentation. |
| @@ -1,5 +1,6 @@ | |||
| # loo (development version) | |||
|
|
|||
| * Use `posterior::is_constant()` instead of a copy in loo and require posterior >= 1.8.0 (#408) | |||
There was a problem hiding this comment.
Can you adapt this point and make it consistent with the style of the other points in NEWS.md and add also your GitHub name for acknowledgement.
There was a problem hiding this comment.
Thanks @florence-bockting!I updated the bullet to match the other entries and added my GitHub name (4964f94).
There was a problem hiding this comment.
Great. Thank you. I will go ahead and merge the PR now. Congrats for your first merged PR in loo =)
Signed-off-by: Soujas K <kudchadkarsoujas@gmail.com>
Part of #408
loo kept its own
is_constant()inR/helpers.R. Since #407 it uses a tolerance relative to the magnitude ofx, and posterior 1.8.0 has the same function (stan-dev/posterior#469). This PR removes the copy and usesposterior::is_constant()in.E_loo_khat_i().Changes:
R/E_loo.R: callposterior::is_constant()R/helpers.R: remove loo'sis_constant()DESCRIPTION: requireposterior (>= 1.8.0). posterior 1.7.x still has the absolute tolerance, so without the bump the problem fixed in Use a relative tolerance in is_constant #407 would come back for users with an older posterior.tests/testthat/test_0_helpers.R: remove the test of loo's copytests/testthat/test_E_loo.R: remove theskip_if()for an older posterior, so the scale test always runsNEWS.md: add a bulletRequiring posterior 1.8.0 so soon after its release is your call. If you prefer to wait, I can keep this PR open until then.
I left out the
n_pareto/ps_tail_lengthceiling vs floor question, since that is still open in #408.Tests:
devtools::test()passes locally (1366 passed, 0 failed, 0 skipped) with R 4.4.3 and posterior 1.8.0.AI disclosure: I used Claude to help prepare this change. I reviewed and understood all of it and can explain and defend it in review.