gpytorch icon indicating copy to clipboard operation
gpytorch copied to clipboard

Calculating probability of draw from posterior distribution

Open andersdot opened this issue 2 years ago • 3 comments

I'm fitting a GP to some data y1, and want to calculate the probability of some different data, y2, under that GP model.

So p( y2 | GP(y1) )

Is that possible?

Cheers

andersdot avatar Feb 28 '22 22:02 andersdot

Yeah you can compute the posterior prediction under your input x2 if associated with a pair (x2, y2) - for an exact GP this will give you a MVN, and you can then just compute the log prob of the data y2 under that.

Balandat avatar Feb 28 '22 23:02 Balandat

Thanks! If I'm not doing an exact GP, how do I calculate the log prob of data y2?

andersdot avatar Mar 01 '22 01:03 andersdot

It should be the same for a variational model. Train the variational model on x1, y1, and then make a prediction on x2. This should also output an MVN, and so you could then compute the logprob of y1.

Of course, everything is approximate in this case.

gpleiss avatar Mar 04 '22 19:03 gpleiss