I am looking at the R function gausspr from the kernlab package for Gaussian process regression. The process is defined by the hyperparameters of the kernel function and by the noise in the data. I see in the documentation that I can specify
var: the initial noise variance, (only for regression) (default : 0.001)
but I do not see how to access the estimated value after the regression has run. For instance, consider I have some observed points, and want to predict y values at the locations given by X:
obs <- data.frame(x = c(-4, -3, -1, 0, 2),
y = c(-2, 0, 1, 2, -1))
X <- seq(-5,5,len=50)
I can do so with kernlab::gausspr as such:
gp <- gausspr(obs$x, obs$y, kernel="rbfdot", scaled=FALSE, var=.09)
Ef <- predict(gp, X)
I can get the estimated value of the kernel hyperparameter:
gp@kernelf@kpar
But I don’t see how I can return the estimated value of the noise parameter, var?
I might be overlooking something, but I don’t think that the initial noise variance
varis “fit” to anything; I don’t think it is a parameter (although I agree that using the word “initial” makes you think otherwise).The noise variance is just added to the diagonal of the correlation matrix of the training points, as described on this page about some other software. Looking through the function definition, it looks like this is exactly what it is doing in
kernlabas well:If you wanted to get the error (or any measure of fit) by the noise variance, you could do something like:
The built-in cross-validation does not “fit”
varin any way, from what I can tell. The only relevant line in the cross validation is here:And you can see that
varis just put in with no changes.