dfm / dfm/corner.py

Apply priors on 1 and 2d histograms

Open
#50 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
576
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Hi,
Not too much of an issue here, more of an additional feature.
The idea is to multiply the 1d and 2d histograms curves/surfaces with the respective prior of each parameter, so that the full "posterior distribution" is plotted - not just the likelihood of the raw samples.

It seemed that the "weights" arguments served another purpose, so I hacked something together. It actually holds in a tiny amount of lines.
Only one new input argument "priors" is needed. It is a N-list of (callable, dict) (for N parameters). The callable argument being the function to call with the dict as *_kwargs:
prior_prob = callable(x, *_dict).
The only drawback is the loss of the parameter "histtype" (hist_kwargs["histtype"]) for the 1d histograms, since they are now always plotted with ax.plot(...) whether they have smoothing or not.
Cheers,
G. Schworer @ceyzeriat

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the 1D and 2D histogram plotting entry points and reviewing how their current weights arguments are handled. Add support for the proposed priors list of callable-and-dict pairs, and verify that both histogram curves and surfaces represent the posterior rather than only the likelihood; check the documented histtype limitation for 1D plots.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.