Add support for conditional JointPriors#864
Open
JasperMartins wants to merge 22 commits intobilby-dev:mainfrom
Open
Add support for conditional JointPriors#864JasperMartins wants to merge 22 commits intobilby-dev:mainfrom
JasperMartins wants to merge 22 commits intobilby-dev:mainfrom
Conversation
0cf2c7e to
2f71ffe
Compare
…ray and update in-place once all keys are requested. Changed (Conditional)PriorDict.rescale to always return samples in right shape.
…h ConditionalPriors
…onditional properties of the priors can be set to arrays or loop over rescale values if not
… Remove necessity to initialize a whole new class instance for lists of dicts that do not span all keys of the ConditionalPriorDict
…onditions_resolved of (Condtional)PriorDict - keep track of dependencies of JointPriors necessary for their complete evaluation and handle cases where not all necessary keys are requested.
2f71ffe to
aaca2f8
Compare
Contributor
Author
|
Regardless of my above discussion point (which would be a larger overall change), I think the changes are ready for enabling Joint Conditional Priors, so I would like to ask about the prospects of this PR. |
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.
This fairly big PR updates ConditionalPrior, ConditionalPriorDict, JointPrior, and MultivariateGaussianDist. Since the changes are highly intertwined, I opted for only one PR. The main goal of this PR is to make it possible to use ConditionalJointPriors.
The changes are the following:
ConditionalPriorDict.rescaleis fixed. Previously, it would not have been possible to rescale a subset of keys. Also, the check if the setting of the reference_params as done forConditionalPriorDict.samplesupports array is applied forrescaleas well. Further, bothConditonalPriorDict.rescaleandsamplewere updated to no longer need to create a copy of theConditionalPriorDictwith the requested subset of keys.ConditionalPriorDict.check_conditions_resolvednow checks ifJointPrior.distdependencies are resolved as well. If a JointPrior is a dependency of another prior, all JointPriors associated with the dist of that JointPrior need to be evaluated before the dependency is evaluated - otherwise, rescaling would always fail.ConditionalPrioris updated to supportJointPriors. This required accepting the named argumentdistand a bit more flexibility on which named arguments to pass towards the init-function of the superclass. This also resulted in a change to the methodget_instantiation_dict, which now only collects properties required to initialize the superclass and not all (named) arguments ofConditionalPrior.JointPrioris updated to be able to set properties ofBaseJointPriorDist-subclasses if these have explicit setter methods for these properties. That way, it ensures that no properties are changed in ways that would potentially breakBaseJointPriorDist-subclasses.MultivariateGaussianDistis updated to allow setting the mode to sample/rescale/calculate. This makes it possible to useConditionalPriorDictto have a prior select the current mode. Using multimodal multivariate Gaussians for sampling is more straightforward that way, as it allows modes to "die off" during sampling if they do not contribute to the posterior. The implementation also supports arrays of different modes for different samples. Further, a few changes are made to_rescale,_sampleand_ln_probto be more efficient for large numbers of samples.BaseJointPriorDistis fixed whereboundswere not applied correctly.Depends on #863