Replies: 1 comment
-
|
If you have a standard GP model (e.g. like in https://docs.gpytorch.ai/en/stable/examples/01_Exact_GPs/Simple_GP_Regression.html), then a forwards pass from the model will give you the mean and covariance: model = ExactGP(train_x, train_y, likelihood)
output = model(train_x)
output.mean # prior mean
output.covariance_matrix # prior covariance matrixBut more generally, the LOOCV is already implemented in gpytorch, see https://github.com/cornellius-gp/gpytorch/blob/master/gpytorch/mlls/leave_one_out_pseudo_likelihood.py (not sure why it's not coming up in the docs). from gpytorch.mlls import LeaveOneOutPseudoLikelihood
loocv = gpytorch.mlls.LeaveOneOutPseudoLikelihood(likelihood, model)
output = model(train_x)
loss = -loocv(output, train_y) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, how can I access to the different parts of a GP model in exactgp like covariance matrix and mean for calculating the LOOCV?
Thanks,
Sanaz
Beta Was this translation helpful? Give feedback.
All reactions