Skip to content

{Question} How to compute the posterior covariance matrix on the training data? #2532

Open
@r-ashwin

Description

@r-ashwin

Let's say I have a GP with n training points. How to compute the nxn covariance matrix on the training data with the posterior GP.

def fit_full_model(train_X, train_Y):
    train_Yvar = torch.ones_like(train_Y).reshape(-1,1) * 1E-4
    fullmodel = FixedNoiseGP(train_X, train_Y.reshape(-1,1), train_Yvar)
    return fullmodel

train_X = torch.linspace(0, 1, 100).reshape(-1,1)
train_Y = torch.sin(train_X).reshape(-1,1)
model = fit_full_model(train_X, train_Y)
model.eval()

I believe the covariance matrix is encoded as a lazy tensor and never actually evaluated. But I do need access to it for a specific application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions