Regression.CV.Fit: Cross-Validated Training and Prediction of Regression Base...

Description Usage Arguments Value Author(s) See Also Examples

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

1
2
3
4
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 Regression.Config (must be a concrete implementation of the base class, such as KNN.Regression.Config).

formula

Formula object expressing response and covariates.

data

Data frame containing response and covariates.

partition

Data partition, typically the output of generate.partition function.

tmpfiles

List of temporary files to save the est field of the output Regression.FitObj.

print.level

Integer setting verbosity level of command-line output during training.

object

An object of class Regression.FitObj.

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

Regression.CV.FitObj

Examples

 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)

EnsembleBase documentation built on May 2, 2019, 2:10 p.m.