Learn R Programming

liquidSVM (version 1.2.4)

mcSVM: Multiclass Classification

Description

This routine is intended for both binary and multiclass classification. The binary classification is treated by an SVM solver for the classical hinge loss, and for the multiclass case, one-verus-all and all-versus-all reductions to binary classification for the hinge and the least squares loss are provided. The error of the very first task is the overall classification error. svmMulticlass is a simple alias of mcSVM

Usage

mcSVM(x, y, ..., predict.prob = FALSE, mc_type = c("AvA_hinge",
  "OvA_ls", "OvA_hinge", "AvA_ls"), do.select = TRUE)

svmMulticlass(x, y, ..., predict.prob = FALSE, mc_type = c("AvA_hinge", "OvA_ls", "OvA_hinge", "AvA_ls"), do.select = TRUE)

Arguments

x

either a formula or the features

y

either the data or the labels corresponding to the features x. It can be a character in which case the data is loaded using liquidData. If it is of type liquidData then after training and selection the model is tested using the testing data (y$test).

...

configuration parameters, see Configuration. Can be threads=2, display=1, gpus=1, etc.

predict.prob

If TRUE then a LS-svm will be trained and the conditional probabilities for the binary classification problems will be estimated. This also restricts the choices of mc_type to c("OvA_ls","AvA_ls").

mc_type

configures the the multiclass variants for All-vs-All / One-vs-All and with hinge or least squares loss.

do.select

if TRUE also does the whole selection for this model

Value

an object of type svm. Depending on the usage this object has also $train_errors, $select_errors, and $last_result properties.

Details

Please look at the demo-vignette (vignette('demo')) for more examples.

mcSVM is best used with factor-labels. If there are just two levels in the factor, or just two unique values if it is numeric than a binary classification is performed. Else, by using the parameter mc_type different combinations of all-vs-all (AvA) and one-vs-all (OvA) and hinge (hinge) and least squares loss (ls) can be used.

If a test is performed then not only the final decision is returned but also the results of the intermediate binary classifications. This is indicated in the column names. If the training labels are given by a factor then the final decision will be encoded in this factor. If this is the case and AvA_hinge is used, then also the binary classification problems will receive the corresponding label...

See Also

Configuration

Examples

Run this code
# NOT RUN {
model <- mcSVM(Species ~ ., iris)
model <- mcSVM(Species ~ ., iris, mc_type="OvA")
model <- mcSVM(Species ~ ., iris, mc.type="AvA_hi")
model <- mcSVM(Species ~ ., iris, predict.prob=TRUE)

## a worked example can be seen at

vignette("demo",package="liquidSVM")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab