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

Issue 559: Diagnostic analysis over all inference runs #560

Merged
merged 10 commits into from
Dec 19, 2024

Conversation

SamuelBrand1
Copy link
Collaborator

This PR closes #559

This PR adds an analysis function which returns details around the MCMC convergence:

  • Proportion of all parameters get less than a bulk ess of 400 (tunable).
  • Proportion of all parameters get less than a tail ess of 100 (tunable).
  • Proportion of all parameters with an R hat more than 0.02 away from 1.
  • The tail ess of the cluster factor for neg bin sampling. Special attention paid to this parameter because its a likely candidate for identifiability problems.

The PR also adds a script to run this across all inferences, and adds recording successes to the success/fail analysis.

@SamuelBrand1 SamuelBrand1 linked an issue Dec 18, 2024 that may be closed by this pull request
Copy link
Contributor

Try this Pull Request!

Open Julia and type:

import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/CDCgov/Rt-without-renewal", rev="559-report-for-mcmc-quality", subdir="EpiAware")
using EpiAware

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.96%. Comparing base (ab73d9e) to head (09264f0).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #560   +/-   ##
=======================================
  Coverage   90.96%   90.96%           
=======================================
  Files          60       60           
  Lines         863      863           
=======================================
  Hits          785      785           
  Misses         78       78           

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

@SamuelBrand1 SamuelBrand1 requested a review from seabbs December 18, 2024 22:36
seabbs
seabbs previously approved these changes Dec 19, 2024
Copy link
Collaborator

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

This looks great. It would be nice to add a test to show the core mcmc diagnostic functions works in and of itself. I think it would also be good for the future to add some convergence summaries beyond the thresholds (I think having a figure on this was planned in the analysis plan but it can be a follow up issue/PR as its not on the critical path for this feature

Also removed unnecessary call to `fetch`
@SamuelBrand1
Copy link
Collaborator Author

I think this is ready for rereview: less DRY, unit test for the mcmc_convergence and more stats.

@SamuelBrand1
Copy link
Collaborator Author

SamuelBrand1 commented Dec 19, 2024

I've gone for:

  • proportion pass (relative to threshold)
  • mean
  • min
  • max

NB r hat is presented as abs diff from 1.0 e.g a mean of 0.001 is good not bad!

@SamuelBrand1 SamuelBrand1 requested a review from seabbs December 19, 2024 12:48
@seabbs seabbs enabled auto-merge December 19, 2024 13:32
Copy link
Collaborator

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

Nice looks good to me!

@seabbs seabbs added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit 7dde0e9 Dec 19, 2024
10 checks passed
@seabbs seabbs deleted the 559-report-for-mcmc-quality branch December 19, 2024 14:38
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.

Report for MCMC quality
3 participants