Using data as initial guess for GP

Hello everyone

I was reading through the Latent Variable implementation of GP and found that when a GP prior is specified it is done for certain function input values

f = gp.prior("f", X=X)

My question is it is possible to specify more information for the GP? I have one set of data with uncertainty that i want to use as a initial guess for the GP and then another set of data which is the observable for the likelihood function. In my head it would look something like

f = gp.prior("f", X=X, Y=Y, SD=SD)

Okay i came up with an idea that might work, what if i specify the a mean function which is the value of the data? It is possible to specify custom mean function in pymc3, so i could specify the data.

So i have tried to define a new class for the mean function, but since i have never worked with classes before i am struggling. I was hoping i could modify the constant example to take in an array instead

class Data(

def __init__(self, c=y):
    self.c = c

def __call__(self, X):
    return tt.alloc(1.0, X.shape[0]) * self.c

or may be just use the def__call directly

    def __call__(self, y):
    return tt.alloc(1.0, y.shape[0]) * y

Where y is the y values of my data. The mean function does not seem to register at all

AttributeError: module '' has no attribute 'Data'

I found what i was looking for. I just needed to define a testval for the gp.prior

f=gp.prior('f', X=X,testval=y)

I am not sure if it is possible to include the uncertainty as well, but this should be a good initial gues for what i am doing.

I don’t think that’s quite what you want. The testval is just the initial value, which will be forgotten as soon as you start sampling/optimizing, irrespective of how much data there is. The “prior guess” should be encoded as a mean function, which is what estimates will shrink to in the absence of data.

Okay, the thing is for my use case i do not want/need the estimates to shrink to the mean function in the absence of any data. While the prior in this case is an initial guess, i still want it to “wander off” if that guess is wrong.

HI。I also readed Latent Variable implementationof GP ,and I try to run it from the Web page. However, some trouble my image. Do you know this cause.