Open ceyzeriat opened 9 years ago
Can you explain what you think weights
does differently? That's exactly what it was for!
Indeed weights parameter of np.histogram or plt.hist is the way to apply a prior to the histogram. However from reading your code, the same weight/prior is applied to each parameter the same way. e.g. for a 3 parameters triangle plot, the input data will be shape(N, 3). If I have different weights/priors for each parameter, I would like to have my weight data to be shape(N, 3). But for now the weights parameter must be shape(N). Or maybe I just missed something too obvious!
I'm trying to catch up on old issues here:
Each weight corresponds to a specific sample with different parameter values in each case. In your case, I think what you would want is for the weight to be the product of priors evaluated at the parameter values of that sample.
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