Функция predict.gp
(которая вызывается при использовании predict
для объекта mlpeg
) принимает аргумент 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)
Тогда
predict(fit)
и
predict(fit, newData = fit$X)
дают тот же результат. Затем вы можете изменить newData
в соответствии с вашими тестовыми данными.