klaR (version 0.3-0)

svmlight: Interface to SVMlight

Description

Function to call SVMlight from R for classification. Multiple group classification is done with the one-against-rest partition of data.

Usage

svmlight(x, ...)

## S3 method for class 'default':
svmlight(x, grouping, temp.dir = NULL, pathsvm = NULL, del = TRUE,
    svm.options = NULL, prior = NULL, out = FALSE,...)
## S3 method for class 'data.frame':
svmlight(x, ...)
## S3 method for class 'matrix':
svmlight(x, grouping, ..., subset, na.action = na.fail)
## S3 method for class 'formula':
svmlight(formula, data = NULL, ..., subset, na.action = na.fail)

Arguments

x
matrix or data frame containing the explanatory variables (required, if formula is not given).
grouping
factor specifying the class for each observation (required, if formula is not given).
formula
formula of the form groups ~ x1 + x2 + .... That is, the response is the grouping factor and the right hand side specifies the (non-factor) discriminators.
data
Data frame from which variables specified in formula are preferentially to be taken.
temp.dir
directory for temporary files.
pathsvm
Path to SVMlight binaries (required, if path os unknown by the OS).
del
Logical: whether to delete temporary files
svm.options
Optional parameters to SVMlight. For further details see: How to use on http://svmlight.joachims.org/.
prior
A Priori probabilities of classes.
out
Logical: whether SVMlight output ahouild be printed on console (only for Windows OS.)
subset
An index vector specifying the cases to be used in the training sample. (Note: If given, this argument must be named.)
na.action
specify the action to be taken if NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values
...

Value

  • A list containing the function call and the result of SVMlight.

Details

Function to call SVMlight from R for classification. Multiple group classification is done with the one-against-rest partition of data. SVMlight is an implementation of Vapnik's Support Vector Machine. It is written in C by Thorsten Joachims. On the homepage (see below) the source-code and several binaries for SVMlight are available. If more then two classes are given the SVM is learned by the one-against-rest scheme. That means that each class is trained against the other K-1 classes. The class with the highest decision function in the SVM wins. So K SVMs have to be learned.

References

http://svmlight.joachims.org/

See Also

predict.svmlight,svm,

Examples

Run this code
## Only works if the svmlight binaries are in the path.
data(iris)
x <- svmlight(Species ~ ., data=iris)

Run the code above in your browser using DataLab