I would like to see built-in functionality that allows me to use a Histogram as a function that returns the weight of the histogram at a given point in state space. The closest thing i can find is the
kde() function from
KernelDensity.jl which produces a distribution, say
p , from data
p=kde(d) . The distribution can then be evaluated at a point
x in state space via
pdf(p,x) . However,
kde() takes too long for my purposes, but
h=fit(Histogram,d) is rather quick in comparison. Furthermore, my state space is multivariate, so
kde() will only let me approximate the marginal distributions while
fit(Histogram,d) lets me approximate multivariate distributions. It would be great if i could take
h and compute the weight at
x via something like
pdf(h,x) . I understand Histograms come with edges and weights, so all the necessary ingredients are there.
The reason i want this is for fast Bayesian inference. I’m using an MCMC-like approach to approximate the likelihood surface. Instead of producing a function that approximates the likelihood, this approach produces a sample whose histogram is proportional to an approximation of the likelihood.