-
Notifications
You must be signed in to change notification settings - Fork 10
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
Include priors from any sampled distributions. #18
Conversation
martin-millon
commented
Oct 11, 2022
- This includes a new subpackage to perform a Kernel Density Estimation (KDE) on any sampled distribution and use it as a prior (example notebook will available on the TDCOSMO GitHub)
- The KDE is tested up to a 5D parameters space and returns an accurate estimation of the probability distribution.
- This returns the same results as the importance sampling technique, up to the sampling precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great and well tested! I only had one or two minor requests for docstrings and then ready to merge. Thank you very much!
:param params: (dictionnary). Dictionnary containing the samples. | ||
:param default_weights: (numpy array). Default weights associated to the samples. | ||
:param cosmology: (str). Astropy cosmology | ||
:param rescale: (bool). Rescale the chains between 0 and 1 for all parameters. This is absolutely necessary if you want to evaluate a KDE on these chains. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loglsamples is missing in the docstrings
return [w for w in self.weights.keys() if len(self.weights[w]) > 0] | ||
|
||
def fill_default(self, param, default_val, nsamples=None, verbose=False): | ||
"""fill an empty default param with a default value""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add docstrings here? Thank you!