Regression.CV.Fit {EnsembleBase} | R Documentation |
Cross-Validated Training and Prediction of Regression Base Learners
Description
This function trains the base learner indicated in the configuration object in a cross-validation scheme using the partition
argument. The cross-validated predictions are assembled and returned in the pred
slot of the Regression.CV.FitObj
object. Individual trained base learners are also assembled and returned in the return object, and used in the predict
method.
Usage
Regression.CV.Fit(regression.config, formula, data
, partition, tmpfiles = NULL, print.level = 1)
## S3 method for class 'Regression.CV.FitObj'
predict(object, newdata=NULL, ...)
Arguments
regression.config |
An object of class |
formula |
Formula object expressing response and covariates. |
data |
Data frame containing response and covariates. |
partition |
Data partition, typically the output of |
tmpfiles |
List of temporary files to save the |
print.level |
Integer setting verbosity level of command-line output during training. |
object |
An object of class |
newdata |
Data frame containing new observations. |
... |
Arguments passed to/from other methods. |
Value
Function Regression.CV.Fit
returns an object of class Regression.CV.FitObj
. Function predict.Regression.CV.FitObj
returns a numeric vector of length nrow(newdata)
.
Author(s)
Alireza S. Mahani, Mansour T.A. Sharabiani
See Also
Examples
data(servo)
myformula <- class~motor+screw+pgain+vgain
myconfig <- make.configs("knn", config.df=data.frame(kernel="rectangular", k=10))
perc.train <- 0.7
index.train <- sample(1:nrow(servo), size = round(perc.train*nrow(servo)))
data.train <- servo[index.train,]
data.predict <- servo[-index.train,]
mypartition <- generate.partition(nrow(data.train),nfold=3)
ret <- Regression.CV.Fit(myconfig[[1]], myformula, data.train, mypartition)
newpred <- predict(ret, data.predict)