เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Visualizing decision & margin bounds using `plot()`

In this exercise, you will rebuild the SVM model (as a refresher) and use the built in SVM plot() function to visualize the decision regions and support vectors. The training data is available in the dataframe trainset.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Support Vector Machines in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Load the library needed to build an SVM model.
  • Build a linear SVM model using the training data.
  • Plot the decision regions and support vectors.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

#load required library
library(___)

#build svm model
svm_model<- 
    svm(y ~ ., data = ___, type = "C-classification", 
        kernel = "___", scale = FALSE)

#plot decision boundaries and support vectors for the training data
plot(x = svm_model, data = ___)
แก้ไขและรันโค้ด