LoginSignup
0
1

More than 5 years have passed since last update.

Rでsvm

Last updated at Posted at 2017-07-26

ここを参考に
http://qiita.com/kokumura/items/64eefc8594995b1d0713

R
install.packages("e1071")
library(e1071)
install.packages("kernlab")
library(kernlab)
R
wet_train <- read.delim("train.txt", sep="\t", stringsAsFactors=T, header=F, fileEncoding="utf-8")
wet_model <- ksvm(V10 ~ ., data=wet_train, type = "C-bsvc", kernel = "rbfdot")
wet_test <- read.delim("test.txt", sep="\t", stringsAsFactors=T, header=F, fileEncoding="utf-8")
result <- predict(wet_model, wet_test)
table(result, wet_test$V10)
result   Ame Hare Kumori Yuki
  Ame      0    1      1    2
  Hare    33  196    157    9
  Kumori 122  213    341   19
  Yuki     0    0      1    1

関数 "ksvm" を見つけることができませんでした などのエラーが出た場合は、
Error: could not find function "ksvm" などでググれば良い

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1