Question about inversion with user defined likelihood function

Hi UQ World!
I’m performing Bayesian inversion with user-defined likelihood function in the case of Gaussian additive discrepancy with parameterized covariance matrix.
Let params and y be respectively the parameters and the data of my user-defined likelihood. The params matrix should be passed by UQlab as a C x M matrix, where C is the number of chains and M is the number of inputs. However, I noticed that, while the MCMC algorithm is running, the first dimension of the params matrix (passed by UQlab to the custom-likelihood) is lower than C.
In other words, running the example “uq_Example_Inversion_06_UserDefinedLikelihood.m” and letting the number of queried realizations nReal in “uq_customLogLikelihood.m” to be printed (removing the semicolon in line 18 ), I find numbers lower than C.
Shouldn’t nReal be always equal to C?

Hi Giovanni and welcome to UQWorld!

You are partially correct :slight_smile:. In principle C should be the number of likelihood calls at each iteration of the paralyzed MCMC algorithm. However, the default AIES algorithm calls the likelihood function sequentially (except for the first call), which is why in this case nReal will always be 1.

For the other MCMC algorithms, nReal will be smaller than C because the likelihood function is not evaluated at realizations of \mathbf{X} that have a zero prior probability. This is done for efficiency because the resulting realizations would be rejected anyway.

The main reason this happens is that some proposed realizations lie outside the prior support.

Let me know if you have any more questions!

1 Like

Hi Paul-Remo!
You’ve been very helpful. Thank you very much! :grinning: