SVM {structToolbox}R Documentation

SVM model classifier

Description

Support vector machines model classifier. Wraps svm from the "e1071" package, which interfaces with the "libsvm" library to train SVM classifiers.

Usage

SVM(
  factor_name,
  kernel = "linear",
  degree = 3,
  gamma = 1,
  coef0 = 0,
  cost = 1,
  class_weights = NULL,
  ...
)

Arguments

factor_name

The sample-meta column name to use for group labels

kernel

the kernel used in training and predicting. You might consider changing some of the following parameters, depending on the kernel type.

linear:

u'*v

polynomial:

(gamma*u'*v + coef0)^degree

radial basis:

exp(-gamma*|u-v|^2)

sigmoid:

tanh(gamma*u'*v + coef0)

degree

parameter needed for kernel of type polynomial (default: 3)

gamma

parameter needed for all kernels except linear (default: 1/(data dimension))

coef0

parameter needed for kernels of type polynomial and sigmoid (default: 0)

cost

cost of constraints violation (default: 1)—it is the ‘C’-constant of the regularization term in the Lagrange formulation.

class_weights

a named vector of weights for the different classes, used for asymmetric class sizes. Not all factor levels have to be supplied (default weight: 1). All components have to be named. Specifying "inverse" will choose the weights inversely proportional to the class distribution.

...

additional slots and values passed to struct_class

Value

struct object

Examples

M = SVM(factor_name='Species',gamma=1)

[Package structToolbox version 1.0.1 Index]