1
下面是代碼:伽瑪在SVM改變與徑向內核
library(e1071)
set.seed(1)
x = matrix(rnorm(200 * 2), ncol = 2)
x[1:100, ] = x[1:100, ] + 2
x[101:150, ] = x[101:150, ] - 2
y = c(rep(1, 150), rep(2, 50))
dat = data.frame(x = x, y = as.factor(y))
head(dat)
plot(x, col = y)
train = sample(200, 100)
svmfit = svm(y ~ ., data = dat[train, ], kernel = "radial", gammma = 1, cost = 1)
plot(svmfit, dat[train, ])
summary(svmfit)
在總結伽馬參數是不同的東西我設置:
Call:
svm(formula = y ~ ., data = dat[train, ], kernel = "radial", gammma = 1, cost = 1)
Parameters:
SVM-Type: C-classification
SVM-Kernel: radial
cost: 1
gamma: 0.5
Number of Support Vectors: 36
(18 18)
Number of Classes: 2
Levels:
1 2
出了什麼問題?