Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中高斯过程回归测试集的预测_R_Gaussian - Fatal编程技术网

R中高斯过程回归测试集的预测

R中高斯过程回归测试集的预测,r,gaussian,R,Gaussian,mlegp软件包说明了如何进行高斯过程拟合,但mlegp软件包中提到的R代码仅演示了使用predict方法重建原始功能输出。有人能帮助我理解如何在测试集上使用GPR进行预测吗?函数predict.gp(在mlpeg对象上使用predict时会调用该函数)使用newData参数,请参见?predict.gp: Usage: ## S3 method for class 'gp' predict(object, newData = object$X, se.fit = FALS

mlegp
软件包说明了如何进行高斯过程拟合,但
mlegp
软件包中提到的R代码仅演示了使用
predict
方法重建原始功能输出。有人能帮助我理解如何在测试集上使用GPR进行
预测吗?

函数
predict.gp
(在
mlpeg
对象上使用
predict
时会调用该函数)使用
newData
参数,请参见
?predict.gp

Usage:

     ## S3 method for class 'gp'
     predict(object, newData = object$X, se.fit = FALSE, ...)

Arguments:

  object: an object of class ‘gp’

 newData: an optional data frame or matrix with rows corresponding to
          inputs for which to predict.  If omitted, the design matrix
          ‘X’ of ‘object’ is used.
  ...
考虑一下简单的模型

library(mlepg)
x = -5:5
y = sin(x) + rnorm(length(x),sd = 0.1)
fit = mlegp(x, y)
然后


给出了相同的结果。然后,您可以根据您的测试数据更改
newData

predict函数抛出错误,没有适用于“gp.list”类对象的“predict”方法@aanchalsharma请编辑您的主要帖子,以包含代表性和最小样本数据。在不了解(1)您正在处理的数据和(2)您正在执行的实际代码的情况下,很难(不可能)提供帮助。为了使您的问题具有可复制性,我们应该能够从您的帖子中复制并粘贴代码,并复制您看到的确切错误。否则这是一个猜测游戏。您还应该了解如何提供一个服务。
predict(fit)
predict(fit, newData = fit$X)