library("kernlab")
model <- ksvm(factor(is_out) ~., data=training, kernel = "rbfdot")
pred <- predict(model, newdata=test2, type="response")             
confusionMatrix(pred, test2$is_out)     


library(e1071)
tunemodel <- tune.svm(factor(is_out) ~., data=training, gamma = 2^(-4:0), cost = 2^(-2:2))
tunemodel

model  <- svm(factor(is_out) ~ ., data = training, kernel = "radial" )
pred <- predict(model, newdata=test)
table(pred, test$is_out)

pred <- predict(model, newdata=test, probability = T)
confusionMatrix(ifelse(attr(pred, "probabilities")[,2] >= 0.7, 1, 0), test$is_out)


model <- svm(factor(is_out) ~., data=training, method="class", probability=T, class.weights=c("1"=0.45, "0"=0.55))
pred <- predict(model, newdata=test2, type="class")
confusionMatrix(pred, test2$is_out)

[http](http://channelofchaos.tistory.com/25)

svm.png
--蠏碁殊豌: http://channelofchaos.tistory.com/25