Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #411 +/- ##
==========================================
- Coverage 92.48% 92.33% -0.15%
==========================================
Files 31 31
Lines 3139 3157 +18
==========================================
+ Hits 2903 2915 +12
- Misses 236 242 +6 ☔ 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 503361b is merged into master:
|
This branch has not been deployed
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.
Fixes #227.
This PR was assisted by Claude
Summary
sis()andtis()setpareto_kto 0 for every observation, sopareto_k_values()reported the best possible diagnostic value, although loo had not computed any diagnostic.psis()reportsInfwhen the tail has fewer than 5 draws, so for few draws the three methods disagreed (Infforpsis(), 0 for the other two). With many draws they disagreed too:psis()returned the estimated k, and the other two still returned 0.The Pareto k diagnostic depends only on the log ratios, because
psis()estimates k before it smooths the tail.sis()andtis()now compute the same k aspsis()from the same log ratios. The weights of all three methods do not change.Change
pareto_k_i()inR/psis.Rfits the generalized Pareto distribution to the same tail asdo_psis_i(), with the same cutoff and the sameposterior::gpdfit()call, and skips the smoothing. It returnsInfin the cases wheredo_psis_i()does: a tail shorter than 5 draws, a constant tail, or a failed fit.do_sis_i()anddo_tis_i()usepareto_k_i().tis()computes k from the log ratios before truncation.do_importance_sampling()gives the "Not enough tail samples" warning for all three methods. Before, onlypsis()gave it.sis()andtis()now give the high Pareto k warning when k is above the threshold, aspsis()does.pareto_kandtail_lenforsis()andtis()describes the diagnostic.print()of asis_looortis_looobject wrote "using sis_loo ." with a space before the period. I removed the space.For the example in #227 (3 iterations of 2 chains), all three methods now return
Inffor all 32 observations and give the same warnings. With 500 and 1000 draws ofexample_loglik_array(), the three methods return identical k values.sis()andtis()now fit the generalized Pareto distribution once per observation, aspsis()does, so they take a little more time.Tests
tests/testthat/test_tisis.R:psis, sis and tis report the same Pareto k diagnostic: identical k forexample_loglik_array(). An observation with t-distributed log ratios (1 degree of freedom) gives k > 0.7 and the high-k warning for each method.psis, sis and tis report Inf for too few draws: the Inconsistent Pareto k-values for SIS? #227 example givesInffor all observations and both warnings for each method.sis()andtis()with 16 and 10 draws. They expected no warning; they now expect the tail-length warning, the same onepsis()gives.With the master R files, the new and changed tests give 16 failures. With this PR,
devtools::test()withNOT_CRAN=truepasses all 1283 tests and gives no warnings (R 4.6.1, testthat 3.3.2, Linux x86_64).