-
Notifications
You must be signed in to change notification settings - Fork 75
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
Draft: Add support for conditional JointPriors #864
Open
JasperMartins
wants to merge
17
commits into
bilby-dev:main
Choose a base branch
from
JasperMartins:conditionaljointpriors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Draft: Add support for conditional JointPriors #864
JasperMartins
wants to merge
17
commits into
bilby-dev:main
from
JasperMartins:conditionaljointpriors
Conversation
This file contains 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
…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.
JasperMartins
force-pushed
the
conditionaljointpriors
branch
from
November 25, 2024 15:55
0cf2c7e
to
2f71ffe
Compare
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.rescale
is 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.sample
supports array is applied forrescale
as well. Further, bothConditonalPriorDict.rescale
andsample
were updated to no longer need to create a copy of theConditionalPriorDict
with the requested subset of keys.ConditionalPriorDict.check_conditions_resolved
now checks ifJointPrior.dist
dependencies 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.ConditionalPrior
is updated to supportJointPrior
s. This required accepting the named argumentdist
and 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
.JointPrior
is 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.MultivariateGaussianDist
is updated to allow setting the mode to sample/rescale/calculate. This makes it possible to useConditionalPriorDict
to 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
,_sample
and_ln_prob
to be more efficient for large numbers of samples.BaseJointPriorDist
is fixed wherebounds
were not applied correctly.Depends on #863