Visualizing the dataset
In this exercise you will use ggplot() to visualize the dataset you created in the previous exercise. The dataset is available in the dataframe df. Use color to distinguish between the two classes.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Support Vector Machines in R
คำแนะนำการฝึกหัด
- Load
ggplot2library. - Create 2d scatter plot and color the two classes (y = -1 and y = 1) red and blue.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
#load ggplot
library(ggplot2)
#build scatter plot, distinguish class by color
scatter_plot <- ggplot(data = df, aes(x = x1, y = x2, color = ___)) +
___() +
___(values = c("red", "blue"))
#display plot
scatter_plot