caret.train.model.list.default: Can take x and y values as the defaults.

Description Usage Arguments Examples

Description

Can take x and y values as the defaults.

Usage

1
2
## Default S3 method:
caret.train.model.list(x, y, trControl, training.list, ...)

Arguments

x

passed directly to train caret; an object where samples are in rows and features are in columns. This could be a simple matrix, data frame or other type (e.g. sparse matrix)

y

passed directly to train caret; a numeric or factor vector containing the outcome for each sample.

trControl

passed directly to train caret; a list of values that define how this function acts. Default value if each item doesn't have its own trControl. See trainControl and http://topepo.github.io/caret/training.html#custom. (NOTE: If given, this argument must be named.)

training.list;

a list describing a list of train caret values to run. Should be a list of objects generated by get.caret.model.spec. Each should contain exactly two values, to be passed to train caret: method and tuning. If tuning is an integer, it will be passed to tuneLength. If tuning is a data frame, it will be passed to tuneGrid. If it is null, train's default values for tuneLength will apply. Otherwise an error is generated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
obs <- 500
x.vars <-100
y.vals <- sample(c(1,2),obs,replace = TRUE)
x.vals <- as.data.frame(matrix(rnorm(obs*x.vars,0,1),nrow=obs,ncol=x.vars))
x.vals <- apply(x.vals, 2, function(x.col){return(x.col+y.vals)})
trControl <- trainControl(method="repeatedcv", number=10, repeats=3)
  caret.train.model.list(x.vals
  ,y.vals
  ,trControl
  ,list(
   get.caret.model.spec("svmLinear")
   ,get.caret.model.spec("knn")
 )
 )

bjsmith/r-mvpa documentation built on May 30, 2019, 11:53 a.m.