Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function for taking expectations wrt smoothed weights #61

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sethaxen
Copy link
Member

@sethaxen sethaxen commented Dec 24, 2023

This PR adds the API function expectation, which allows one to take some expectation wrt to PSIS-smoothed weights. This is the main function needed to compute expectations wrt LOO posteriors, though it is not limited to this application.

Some notes:

  • Currently the expectand must have shape (draws, [chains, [params...]]), i.e. it might share the data dimensions. This allows the function to be used for data-dependent scalar expectations e.g. loo_pit. However, one might have data-independent dimensions with or without data dimensions, e.g. for computing the LOO posterior means of all marginals. Supporting this could require a keyword that specifies which (trailing) dims in x are unrelated to the data or draws.
  • Currently we do not compute function-specific diagnostics. This requires something like Make smoothing optional #23, so that we can compute diagnostics without then smoothing.
  • Maybe a better way to compute expectations like mean is on the log-scale. However, this would require us to limit which expectations we can support.

Copy link

codecov bot commented Dec 24, 2023

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (3e6e5ec) 97.44% compared to head (7dea818) 89.59%.

Files Patch % Lines
src/expectation.jl 0.00% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
- Coverage   97.44%   89.59%   -7.85%     
==========================================
  Files           6        7       +1     
  Lines         274      298      +24     
==========================================
  Hits          267      267              
- Misses          7       31      +24     

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

@sethaxen sethaxen closed this Dec 26, 2023
@sethaxen sethaxen reopened this Dec 26, 2023
coderabbitai[bot]

This comment was marked as outdated.

@arviz-devs arviz-devs deleted a comment from coderabbitai bot Feb 5, 2025
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.

1 participant