Classifying data with a support vector machine
The two most well-known and popular support vector machine tools are libsvm and SVMLite. For R users, you can find the implementation for libsvm in the e1071 package and SVMLite in the klaR package. Therefore, you can use the implemented function of these two packages to train support vector machines. In this recipe, we will focus on using the svm function (the libsvm implemented version) from the e1071 package to train a support vector machine based on the telecom customer churn data training dataset.
Getting ready
In this recipe, we will continue to use the telecom churn dataset as the input data source to train the support vector machine. For those who have not prepared the dataset, please refer to Chapter 7, Classification 1 - Tree, Lazy, and Probabilistic, for more details.
How to do it...
Perform the following steps to train the SVM:
- Load the
e1071package:
> library(e1071)- Train the support vector machine using the
svmfunction withtrainset...