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

Improvements to ess_rhat #53

Merged
merged 67 commits into from
Jan 12, 2023
Merged

Improvements to ess_rhat #53

merged 67 commits into from
Jan 12, 2023

Conversation

sethaxen
Copy link
Member

@sethaxen sethaxen commented Dec 14, 2022

This PR implements the nonbreaking parts of #22 (specifically, the proposal in #22 (comment)):

  • makes splitting of chains optional
  • support passing an estimator to compute an estimate-specific ESS (and R-hat too, though I don't think this is commonly used)
  • Add ess_rhat_bulk to compute rank-normalized ESS and R-hat
  • Add ess_tail and rhat_tail (the two cannot be simultaneously computed since they use different transformations)

Currently this is marked as a draft while I write more tests and try to figure out how improve type-inferrability for utility functions.

@coveralls
Copy link

coveralls commented Dec 14, 2022

Pull Request Test Coverage Report for Build 3690426417

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 29 of 29 (100.0%) changed or added relevant lines in 2 files are covered.
  • 8 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-2.6%) to 91.859%

Files with Coverage Reduction New Missed Lines %
src/ess.jl 8 93.94%
Totals Coverage Status
Change from base Build 3680569701: -2.6%
Covered Lines: 598
Relevant Lines: 651

💛 - Coveralls

@codecov
Copy link

codecov bot commented Dec 14, 2022

Codecov Report

Base: 94.91% // Head: 95.19% // Increases project coverage by +0.27% 🎉

Coverage data is based on head (a090c4b) compared to base (57cacc1).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
+ Coverage   94.91%   95.19%   +0.27%     
==========================================
  Files          10       10              
  Lines         669      708      +39     
==========================================
+ Hits          635      674      +39     
  Misses         34       34              
Impacted Files Coverage Δ
src/ess.jl 97.98% <100.00%> (+0.11%) ⬆️
src/utils.jl 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/utils.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@sethaxen sethaxen marked this pull request as ready for review January 3, 2023 12:17
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.

I haven't checked the PR in detail yet (since I'm on my phone and tests seem to fail) but one immediate suggestion is to avoid the JLD dependency and the JLD file. Either just use a text file or even better create the data in the tests without storing it.

@sethaxen
Copy link
Member Author

sethaxen commented Jan 3, 2023

...tests seem to fail

yes, the failures are in rstar, which is not touched here, so I'm guessing it's an issue with Random seed.

...one immediate suggestion is to avoid the JLD dependency and the JLD file. Either just use a text file or even better create the data in the tests without storing it.

Generating in the tests is cumbersome. When I tried sampling with Turing, I gave up after nearly an hour of sampling. StanSample can do it within a few minutes, but then we need CmdStan installed to run the tests locally and globally. Plus I wouldn't assume the tests would pass for all possible seeds to the sampler, so if CmdStan ever made a change to its sampler, our tests could suddenly begin failing. I'll add these draws as a text file.

src/ess.jl Show resolved Hide resolved
src/ess.jl Show resolved Hide resolved
src/ess.jl Outdated Show resolved Hide resolved
src/ess.jl Show resolved Hide resolved
src/ess.jl Outdated Show resolved Hide resolved
src/ess.jl Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
test/ess.jl Outdated Show resolved Hide resolved
@sethaxen
Copy link
Member Author

I've implemented all requested changes. Only the windows tests fail, but that's expected. (see #56 (comment))

The references now look a little strange, but it seems to be the best we can do right now:
image

@sethaxen sethaxen mentioned this pull request Jan 12, 2023
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.

Very nice, great PR! Looks good to me once the Linux test passes.

@sethaxen
Copy link
Member Author

Very nice, great PR! Looks good to me once the Linux test passes.

Thanks for the review! Can you merge? The repo settings require all tests pass before merge, and I don't have permissions to override.

@devmotion
Copy link
Member

I changed the settings, now PRs can be merged (from everyone with merge permissions) even if Windows tests fail.

@devmotion devmotion merged commit 4070993 into main Jan 12, 2023
@delete-merged-branch delete-merged-branch bot deleted the essupdates branch January 12, 2023 20:59
@sethaxen
Copy link
Member Author

Thanks!

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