Implementation and derivation of "Variational Bayesian inference for a nonlinear forward model." [Chappell et al. 2008] for arbitrary, user-defined model errors.
visualize_vb_marginal_matrix now takes a contour_quantiles=np.r_[0.5, 0.7, 0.9] argument and visualizes only those quantiles in the bivariate coutours.
The calculation of the actual levels is done numerically based on the 2d probability matrix (already used for the contour plot itself). First, a range of probabilities level_range is defined and for each level the entries larger than this level are summed up. Divided by the total sum, this gives the quantile for that level. Those values are then interpolated to the user defined contour_quantiles.
As @joergfunger pointed out, there is an analytic formula for the case of bivariate normals. The numeric approach is also valid for Gamma/Gamma or Gamma/Normal, and it is "only" for the plot. So if the line is two or three pts off, it should not really matter.
visualize_vb_marginal_matrix
now takes acontour_quantiles=np.r_[0.5, 0.7, 0.9]
argument and visualizes only those quantiles in the bivariate coutours.The calculation of the actual levels is done numerically based on the 2d probability matrix (already used for the contour plot itself). First, a range of probabilities
level_range
is defined and for each level the entries larger than this level are summed up. Divided by the total sum, this gives the quantile for that level. Those values are then interpolated to the user definedcontour_quantiles
.As @joergfunger pointed out, there is an analytic formula for the case of bivariate normals. The numeric approach is also valid for Gamma/Gamma or Gamma/Normal, and it is "only" for the plot. So if the line is two or three pts off, it should not really matter.