One simple algorithm is importance sampling from the prior. Draw independently from and assign weight . Then
estimates the Bayesian model evidence, and the normalized weights represent the posterior. A weighted histogram or kernel density estimation of the estimates the marginal ; discarding performs the marginalization.