Support for Posterior SBC and misc #51
Closed
Cab14bacc wants to merge 30 commits into
Closed
Conversation
…posterior sbc example, added quickstart for posterior sbc
Contributor
|
Better to restrict this PR to posterior SBC and have separate PRs for other features like bug fixes, new functions, etc. |
…ation of rank statistics of another quantity via compute_rank_statistics
… variable so as to match simulator output
…posterior sbc example, added quickstart for posterior sbc
… into feat/Posterior_SBC
…ation of rank statistics of another quantity via compute_rank_statistics
…posterior sbc example, added quickstart for posterior sbc
… into feat/Posterior_SBC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12 and referenced #49
Depends on #53 and #52
This PR introduces support for Posterior SBC using PyMC Models. Given original posterior samples, generate posterior predictive samples, augment them with the original observed data, sample from posterior conditioned on the augmented data, and compute rank statistics comparing the original posterior samples and the augmented posterior samples.
Constraint of Implmentation
Posterior SBC augments the observed data (concatenating original + replicated), which changes its size. For this to work, store observed data in
pm.Datacontainers, and specify size using thedimsparameter instead of setting a static shape.If your model uses
dimsandcoords, you are also responsible for resizing them to the correct size corresponding to the new augmented dataset via theupdate_datacallback. Similarly, if your model has covariates, store them inpm.Dataso they can be resized in the same callback.New Parameters for SBC Class
method="posterior": You can now pass an originaltrace(containing posterior distributions) alongsidemethod="posterior"to execute Posterior SBC.augment_observed: Custom logic for how to augment the posterior predictive sample and the observed data, the default behavior is to concatenate on the first axis.update_data: Called before conditioning on the augmented dataset. custom logic to update the covariates, coords to conform to the new augmented data. There is no default behavior, but if user does not modify variable that are of typepm.Datathat are used for observed data, the code will update according to the augmented data.Misc