Perform the following steps to train the SVM:
- Load the e1071 package:
> library(e1071)
- Train the support vector machine using the svm function with trainset as the input dataset and use churn as the classification category:
> model =svm(churn~., data = trainset, kernel="radial", cost=1,
gamma = 1/ncol(trainset))
- Finally, you can obtain overall information about the built model with summary:
> summary(model) Output Call: svm(formula = churn ~ ., data = trainset, kernel = "radial",
cost = 1, gamma = 1/ncol(trainset))
Parameters: SVM-Type: C-classification SVM-Kernel: radial cost: 1 gamma: 0.05882353 Number of Support Vectors: 691 ( 394 297 ) Number of Classes: 2 Levels: yes no