Skip to content

Conversation

jordandeklerk
Copy link
Member

@jordandeklerk jordandeklerk commented Aug 24, 2025

This adds the loo_i() function to compute PSIS-LOO-CV for a single observation.


Resolves #181


📚 Documentation preview 📚: https://arviz-stats--182.org.readthedocs.build/en/182/

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2025

Codecov Report

❌ Patch coverage is 75.55556% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.54%. Comparing base (a40917b) to head (5fba784).
⚠️ Report is 115 commits behind head on main.

Files with missing lines Patch % Lines
src/arviz_stats/loo/helper_loo.py 66.66% 8 Missing ⚠️
src/arviz_stats/loo/loo.py 85.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
+ Coverage   62.64%   70.54%   +7.89%     
==========================================
  Files          14       39      +25     
  Lines        1925     4345    +2420     
==========================================
+ Hits         1206     3065    +1859     
- Misses        719     1280     +561     

☔ View full report in Codecov by Sentry.
📢 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.

@jordandeklerk jordandeklerk marked this pull request as ready for review August 24, 2025 22:38

loo_inputs = _prepare_loo_inputs(data, var_name)

i = int(i)
Copy link
Contributor

Choose a reason for hiding this comment

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

You checked that i is integer


Parameters
----------
i : int
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use idx?

Copy link
Member Author

@jordandeklerk jordandeklerk Sep 1, 2025

Choose a reason for hiding this comment

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

This is a good point. I initially thought that this function would just be for quick testing mainly with custom log-likelihood functions so the actual indexing wouldn't be relevant. But I think maybe we should account for more calculated options here for the user.

The most recent commit allows for several different ways of doing this. Maybe this is overkill though?

@jordandeklerk
Copy link
Member Author

Most recent change simplifies the way you can select an observation so we're not trying to infer many different ways of doing this.

@aloctavodia aloctavodia merged commit 99c5c4e into arviz-devs:main Sep 2, 2025
3 checks passed
@jordandeklerk jordandeklerk deleted the loo_i branch September 5, 2025 01:58
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.

Add loo_i() function for single observation PSIS-LOO-CV testing
3 participants