BaşlayınÜcretsiz Başlayın

Linear SVM for a radially separable dataset

In this exercise you will build two linear SVMs, one for cost = 1 (default) and the other for cost = 100, for the radially separable dataset you created in the first lesson of this chapter. You will also calculate the training and test accuracies for both costs. The e1071 library has been loaded, and test and training datasets have been created for you and are available in the data frames trainset and testset.

Bu egzersiz

Support Vector Machines in R

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

#default cost mode;
svm_model_1 <- svm(y ~ ., data = ___, type = "C-classification", cost = ___, kernel = "linear")

#training accuracy
pred_train <- predict(svm_model_1, ___)
mean(pred_train == ___$y)

#test accuracy
pred_test <- predict(svm_model_1, ___)
mean(pred_test == ___$y)
Kodu Düzenle ve Çalıştır