View source: R/predict.ENNreg.R
predict.ENNreg | R Documentation |
Predicted values based on a trained ENNreg model (object of class "ENNreg").
## S3 method for class 'ENNreg'
predict(object, newdata, yt = NULL, ...)
object |
An object of type "ENNreg" |
newdata |
Input matrix of attributes for test data |
yt |
Optional test response vector |
... |
Further arguments passed to or from other methods |
Predictions for the new data, coded as a list with the following components:
Predicted means
Predicted standard deviations.
Prediction precisions.
Lower expectation.
Upper expectations
Negative log likelihood (computed only if yt is provided).
Root mean squared error (computed only if yt is provided).
ENNreg
, ENNreg_init
# Boston dataset
library(MASS)
X<-as.matrix(scale(Boston[,1:13]))
y<-Boston[,14]
set.seed(220322)
n<-nrow(Boston)
ntrain<-round(0.7*n)
train <-sample(n,ntrain)
fit <- ENNreg(X[train,],y[train],K=30)
pred<-predict(fit,newdata=X[-train,],yt=y[-train])
plot(y[-train],pred$mux,xlab="observed response",ylab="predicted response")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.