Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
View source: R/gpHistVariance.R
This function is used to estimate (approximate) the variance of new sample from a trained GP.
1 | gpHistVariance( GP,X,x_pred)
|
GP |
Gaussian Process object that has been trained with gpHist |
X |
Data that has been used to train the GP object |
x_pred |
New data whos variance has to be predicted |
Based on the number of estimaited eigenvalues/eigenvetors, the variance is approximated. When only 1 eigenvalue is used, the so called coarse approximation is used. If more eigenvectors are present, the so called fine approximation is used. For deatils look in to paper of refrenced under references
Will return NAN on error or the estimated approximaited variances of the samples
A negative variance cen be retunred. For reasons and workarounds look into note section.
A negative variance can be retunred. This can happen when one eigenvalue is not the highest, rather a lower one. Might also happen when eigenvalue and/or eigenvector is not estimated accurate enough. As workaround consider using less eigenvectors for the estimation of the Gaussian process. Or remove the lowest eigenvalue and vector from the object and call the variance function again. This of course will you provide a worse approximation, but give you a valid variance that you might be able to use instead.
Dennis Becker
The utilized approximations are described in the following paper:
Rodner, E., Freytag, A., Bodesheim, P., Froehlich, B., & Denzler, J. (2016). Large-Scale Gaussian Process Inference with Generalized Histogram Intersection Kernels for Visual Recognition Tasks. International Journal of Computer Vision, pp. 1-28. Springer US. doi:10.1007/s11263-016-0929-y
Package Overview:
gpHist-Package
Function for estimation of the GP:
gpHist
Function for prediction of the mean of new samples:
gpHistPredict
Function for hyperparameter estimation:
estimateHyperParameters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | testFn = function(x){
y = sin(2*pi*x*2)
}
#Get data
X = seq(0,1,0.1)
Y = testFn(X)
#Call gpHist function
gp_hist = gpHist(matrix(X),matrix(Y),sigma=0.01)
x_pred = matrix(seq(0,1,0.01))
prediction = gpHistPredict(gp_hist,matrix( X), x_pred)
vars = gpHistVariance(gp_hist,matrix( X), x_pred)
plot(X,Y)
lines(x_pred, prediction,col='red')
lines(x_pred, prediction+sqrt(vars),lty=2,col='red')
lines(x_pred, prediction-sqrt(vars),lty=2,col='red')
legend('topleft',legend=c('Data', 'Approximation','Coarse std. dev'),
col=c('black','red','red') ,lty=c(NA,1,2),pch=c(1,NA,NA))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.