Skip to content

Add classes to all loo warnings - #417

Merged
florence-bockting merged 8 commits into
masterfrom
add-loo-warning-classes
Nov 13, 2026
Merged

florence-bockting merged 8 commits into
masterfrom
add-loo-warning-classes

Conversation

@florence-bockting

Copy link
Copy Markdown
Contributor

Description

This PR adds a class to each loo warning, following up on our corresponding work in the posteriorpackage: stan-dev/posterior#470.

  • Every warning has the class loo_warning and a class for its cause.
  • Diagnostic warnings have the class loo_warning_diagnostic.
  • The warning text is unchanged and, similar to posterior, a list of warning classes and messages is provided in R/loo-package.R
  • Adds rlang to Imports.
  • Deletes the unused throw_psis_r_eff_warning() and throw_loo_r_eff_warning() (this was dead code)

This PR is related to Issue #353 (but does not fully solve it).
The PR was assisted by an LLM.

@codecov-commenter

codecov-commenter commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.51020% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.88%. Comparing base (e0966d1) to head (6ad3e76).

Files with missing lines Patch % Lines
R/loo_subsample.R 0.00% 11 Missing ⚠️
R/loo_compare.psis_loo_ss_list.R 43.75% 9 Missing ⚠️
R/psis_approximate_posterior.R 66.66% 2 Missing ⚠️
R/psislw.R 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #417      +/-   ##
==========================================
+ Coverage   92.72%   92.88%   +0.16%     
==========================================
  Files          31       31              
  Lines        3270     3289      +19     
==========================================
+ Hits         3032     3055      +23     
+ Misses        238      234       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 6ad3e76 is merged into master:

Status Name Current Incoming Interval
✔️ loo_matrix 1.43s 1.44s [-0.32%, +0.63%]
✔️ loo_function 1.3s 1.29s [-0.56%, +0.34%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@florence-bockting
florence-bockting marked this pull request as ready for review November 3, 2026 06:15

@jgabry jgabry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I made a few suggestions, but pretty small.

Comment thread R/psis.R Resolved
Comment thread R/psis.R Resolved
Comment thread R/loo-package.R Resolved
Comment thread NEWS.md Resolved
Comment thread R/loo-package.R Resolved
Comment thread tests/testthat/test_warning_classes.R Resolved
Comment thread R/loo_subsample.R Resolved

@jgabry jgabry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this is basically ready. I made a few code formatting (indentation) comments and suggested an edit to the NEWS entry.

Comment thread R/loo_compare.psis_loo_ss_list.R Resolved
Comment thread R/loo_subsample.R Resolved
Comment thread R/loo_subsample.R Resolved
Comment thread R/psislw.R Resolved
Comment thread R/psis_approximate_posterior.R Resolved
Comment thread NEWS.md Resolved

@jgabry jgabry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @florence-bockting

@florence-bockting
florence-bockting merged commit 3079dca into master Nov 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants