R में Support Vector Machines
Kailash Awati
Instructor

ggplot() उपयोग करेंp <- ggplot(data = df4, aes(x = x1sq, y = x2sq, color = y)) +
geom_point() +
scale_color_manual(values = c("red", "blue")) +
geom_abline(slope = -1, intercept = 0.49)
p

(gamma * (u.v) + coef0) ^ degreedegree बहुपद की डिग्री हैgamma और coef0 ट्यूनिंग पैरामीटर हैंu, v डेटासेट के वेक्टर (डेटापॉइंट) हैंdegree = 2 सेट करेंcost, gamma और coef0 के डिफॉल्ट मान रखें (1, 1/2 और 0)svm_model <- svm(y ~ ., data = trainset, type = "C-classification", kernel = "polynomial", degree = 2)
# Predictions
pred_test <- predict(svm_model, testset)
mean(pred_test == testset$y)
0.9354839
# Visualize model
plot(svm_model, trainset)

R में Support Vector Machines