trainTuneParetoClassifier: Train a TunePareto classifier

View source: R/classifiers.R

trainTuneParetoClassifierR Documentation

Train a TunePareto classifier

Description

Trains a classifier wrapped in a TuneParetoClassifier object. The trained classifier model can then be passed to predict.TuneParetoModel.

Usage

trainTuneParetoClassifier(classifier, trainData, trainLabels, ...)

Arguments

classifier

A TuneParetoClassifier object as returned by tuneParetoClassifier or one of the predefined classification functions (see predefinedClassifiers).

trainData

The data set to be used for the classifier training. This is usually a matrix or data frame with the samples in the rows and the features in the columns.

trainLabels

A vector of class labels for the samples in trainData.

...

Further parameters to be passed to the classifier. These must be parameters specified in the classifierParameterNames parameter of tuneParetoClassifier and usually correspond to the tuned parameters.

Value

Returns an object of class TuneParetoModel with the following entries

classifier

The classifier object supplied in the classifier parameter

classifierParams

The additional parameters supplied to the classifier in the ... parameter

trainData

If classifier is an all-in-one classifier without a separate prediction method, this stores the input training data.

trainLabels

If classifier is an all-in-one classifier without a separate prediction method, this stores the input training labels.

model

If classifier consists of separate training and prediction methods, this contains the trained classifier model.

See Also

tuneParetoClassifier, predefinedClassifiers, predict.TuneParetoModel

Examples


# train an SVM classifier
cl <- tunePareto.svm()
tr <- trainTuneParetoClassifier(cl, 
                                iris[,-ncol(iris)], 
                                iris[,ncol(iris)], 
                                cost=0.001)

# re-apply the classifier to predict the training data
print(iris[,ncol(iris)])
print(predict(tr, iris[,-ncol(iris)]))

TunePareto documentation built on Oct. 2, 2023, 5:06 p.m.