Description Usage Arguments Details Value See Also Examples
View source: R/gpHistPredict.R
This function is used to predict new sample means. For prediction of the variance the function gpHistVariance is used. This has been done intentially, to provide the chance not to predict the variance if it is not required. Also keep in mind, that you need the data that you used for training of GP to make predictions.
1 | gpHistPredict(GP, X,x_pred)
|
GP |
Gaussian Process object returned by gpHist function |
X |
Original data that has been used for the training of the GP process. |
x_pred |
New data that is to be predicted |
X and x_pred need to be matrix in correct format. Each row is one example of D dimensions.
If the function fails or spotts an error in the parameters NAN is returned. Otherwise the predicted sample mean is returned.
Package Overview:
gpHist-Package
Function for estimation of the GP:
gpHist
Function for prediction of new sample variance:
gpHistVariance
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 | 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)
# New data to predict
x_pred = matrix(seq(0,1,0.01))
#Prediction
prediction = gpHistPredict(gp_hist,matrix( X), x_pred)
# Plot results
plot(X,Y)
lines(x_pred, prediction,col='red')
legend('topleft',legend=c('Data', 'Approximation'), col=c('black','red') ,lty=c(NA,1),pch=c(1,NA))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.