View source: R/machinelearning.R
| train_classifier | R Documentation |
Train a classifier from a dataset object using metadata or data-derived class
labels and a resampling strategy supported by caret.
train_classifier(
dataset,
column.class,
model,
validation,
num.folds = 10,
num.repeats = 10,
tunelength = 10,
tunegrid = NULL,
metric = NULL,
summary.function = caret::defaultSummary,
class.in.metadata = TRUE
)
dataset |
A dataset object. |
column.class |
The metadata column containing the class labels. |
model |
A model name accepted by |
validation |
Validation method used in training. |
num.folds |
Number of folds used in resampling. |
num.repeats |
Number of repeats used in repeated resampling. |
tunelength |
Number of tuning levels evaluated by |
tunegrid |
Optional data frame of tuning parameter combinations. |
metric |
Optional performance metric used for model selection. |
summary.function |
Summary function passed to
|
class.in.metadata |
Logical; if |
A caret training object returned by caret::train().
## Not run:
datamat <- matrix(
rnorm(24),
nrow = 4,
dimnames = list(paste0("v", 1:4), paste0("s", 1:6))
)
metadata <- data.frame(class = factor(c("A", "A", "A", "B", "B", "B")))
dataset <- list(data = datamat, metadata = metadata)
train_classifier(dataset, "class", model = "rpart", validation = "cv")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.