Learn R Programming

specmine (version 3.1.6)

train_classifier: Train classifier

Description

Train a specific classifier.

Usage

train_classifier(dataset, column.class, model, validation, 
num.folds = 10, num.repeats = 10, tunelength = 10, 
tunegrid = NULL, metric = NULL, 
summary.function = defaultSummary, class.in.metadata = TRUE)

Arguments

dataset

list representing the dataset from a metabolomics experiment.

column.class

metadata column class.

model

model to be used in training.

validation

validation method.

num.folds

number of folds in cross validation.

num.repeats

number of repeats.

tunelength

number of levels for each tuning parameters.

tunegrid

dataframe with possible tuning values.

metric

metric used to evaluate the model's performance. Can be "Accuracy" or "ROC".

summary.function

summary function. For "ROC" the multiClassSummary function must be used.

class.in.metadata

boolean value to indicate if the class is in metadata.

Value

Returns the train result object from caret.

Examples

Run this code
# NOT RUN {
  ## Example of training a classifier
  library(specmine.datasets)
  data(cachexia)
  result = train_classifier(cachexia, "Muscle.loss", "pls", "cv")
# }

Run the code above in your browser using DataLab