Using GP and interpolation for model likelihood input

Hello everyone

I have been trying to implement a GP to compare to my data, but i want to go about it in a slightly different way than defining a GP prior over some points. The data has some value at a given point in time (so like f(t)). I want to create an evenly spaced number of points in an array and then for one guess of the hyper-paramters values determine the value of the function at all those points. I then want to interpolate between those points to determine the function value at the same times as the data i have and then use those points as inputs for the likelihood function.

For the first part of getting those evenly spaced points i initially though i could define some evenly spaced priors over my data range

nf = 100
Xf = np.linspace(min(X), max(X), n_new)
f = gp.prior("f", X=Xf)

and then use a conditional distribution to obtain the value at new points given the current value of the trace

n_new = 1000
X_new = np.linspace(min(X), max(X), n_new)
f_sim = gp.conditional("f_sim", X_new)
f_new = pm.sample_posterior_predictive(trace vars=[f_sim], samples=1)
likelihood = pm.Normal('y', mu=f_new, sigma=yerr, observed=y) 

trace = pm.sample(4000,tune=1000,init='advi+adapt_diag',chains=2,cores=8)

Of course this is not possible since the trace has not been defined yet. I also tried to define a conditional over those new points, but that seems to create new variables like a GP prior and is really computationally expensive.

f_sim = gp.conditional("f_sim", X_data)

My question is if it is possible to get the current value of the hyper-parameters during a specific iteration and use them to create function value for a great number of points (compared to the amount of data points) and then interpolate those points to compare with the data? Is this a valid way to update the hyper parameters? And is there a function in pymc3 that can do this already? My guess is i would need to write some function to do a 1-d interpolation in theano similar to this example.

Okay i have implemented the interpolation function like in the example and that works. I am trying to use the GP priors to do the interpolation

likelihood = pm.Normal('y', mu=comp, sigma=yerr, observed=y)

The main reason i am looking for a way to generate points using a conditional distribution is due to efficiency. Defining a bunch of points for the GP prior is expensive computationally, so if i could create a lot of points from the current guess of the hyper-parameters, i believe it would speed up my sampling. This is also the simplest working example i can think of, for my actual use case i am using the GP as an input for a function, which i want to be continuous or at least defined at a lot of points over the range i am considering, so that the interpolation i do with the output of the function using the GP is accurate.