Description Usage Arguments Value Author(s) See Also Examples
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.
1 2 3 4 |
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. |
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)
.
Alireza S. Mahani, Mansour T.A. Sharabiani
1 2 3 4 5 6 7 8 9 10 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.