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

Update ess_hat to not error for short chains #119

Merged
merged 11 commits into from
Feb 14, 2024
Merged

Conversation

sethaxen
Copy link
Member

@sethaxen sethaxen commented Feb 2, 2024

Fixes #117. As a side benefit, ess_rhat for the rhat now returns the same thing as rhat even for few draws.

Copy link
Contributor

github-actions bot commented Feb 2, 2024

Pull Request Test Coverage Report for Build 7900491678

Details

  • 0 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 96.441%

Totals Coverage Status
Change from base Build 7900473350: -0.1%
Covered Lines: 840
Relevant Lines: 871

💛 - Coveralls

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (22220fc) 96.65% compared to head (edd750f) 96.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #119      +/-   ##
==========================================
+ Coverage   96.65%   96.68%   +0.03%     
==========================================
  Files          11       11              
  Lines         867      876       +9     
==========================================
+ Hits          838      847       +9     
  Misses         29       29              

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

@sethaxen
Copy link
Member Author

The remaining error on the MCMCChains integration test is expected.

src/ess_rhat.jl Outdated
@@ -94,7 +94,7 @@ function build_cache(::FFTAutocovMethod, samples::Matrix, var::Vector)

# create cache for FFT
T = complex(eltype(samples))
n = nextprod([2, 3], 2 * niter - 1)
n = nextprod([2, 3], 2 * max(1, niter) - 1)
Copy link
Member

Choose a reason for hiding this comment

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

Since we skip computation of ESS in the special case niter <= 4 anyway, wouldn't it be easier to also skip computing esscache and rel_ess_max? Possibly it's still nice/an improvement to handle the case niter < 1 more gracefully here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored the code to separate allocation of outputs from the allocation of caches with computation of values. When number of iterations is too low, this allows us to directly call the mutating rhat function, which requires no caches.

Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

LGTM if tests pass.

@sethaxen
Copy link
Member Author

@devmotion it seems I don't have permissions to merge even with approval because the required integration test doesn't pass (expected). Could my role be upgraded to Admin?

@devmotion
Copy link
Member

@sethaxen I made you an admin and changed the settings such that admins may bypass the branch protection requirements.

@sethaxen
Copy link
Member Author

Thanks!

@sethaxen sethaxen merged commit c460b8c into main Feb 14, 2024
11 of 12 checks passed
@delete-merged-branch delete-merged-branch bot deleted the noshortchainerror branch February 14, 2024 16:16
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.

Make ess_rhat return NaN instead of erroring
2 participants