SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Downloaden Sie, um offline zu lesen
R: SVM


sesejun@is.ocha.ac.jp
     2010/12/08
SVM
> iris.train <- read.table("iris_train.csv", sep=",", header=T)
> iris.test <- read.table("iris_test.csv", sep=",", header=T)

> library("e1071")

> iris.model <- svm(iris.train[1:4], iris.train$Class)

> iris.pred <- predict(iris.model, iris.test[1:4])

> table(iris.pred, iris.test$Class)

iris.pred         Iris-setosa Iris-versicolor Iris-virginica
  Iris-setosa               7               0              0
  Iris-versicolor           0               9              0
  Iris-virginica            0               0             14




                                                                  2
> iris.model <- svm(iris.train[1:4], iris.train$Class, kernel=”linear”)

> iris.pred <- predict(iris.model, iris.test[1:4])

> table(iris.pred, iris.test$Class)

iris.pred         Iris-setosa Iris-versicolor Iris-virginica
  Iris-setosa               7               0              0
  Iris-versicolor           0               9              0
  Iris-virginica            0               0             14




                                                                      3
4
1. USPS
    1. USPS                        SVM
         radial


    2. K-NN
    3.                          SVM K-NN



•             1   6   15:00 (              )



                                               4

Weitere ähnliche Inhalte

Mehr von sesejun

次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習sesejun
 
20110602labseminar pub
20110602labseminar pub20110602labseminar pub
20110602labseminar pubsesejun
 
20110524zurichngs 2nd pub
20110524zurichngs 2nd pub20110524zurichngs 2nd pub
20110524zurichngs 2nd pubsesejun
 
20110524zurichngs 1st pub
20110524zurichngs 1st pub20110524zurichngs 1st pub
20110524zurichngs 1st pubsesejun
 
20110214nips2010 read
20110214nips2010 read20110214nips2010 read
20110214nips2010 readsesejun
 
Datamining 9th association_rule.key
Datamining 9th association_rule.keyDatamining 9th association_rule.key
Datamining 9th association_rule.keysesejun
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclusteringsesejun
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svmsesejun
 
Datamining 3rd naivebayes
Datamining 3rd naivebayesDatamining 3rd naivebayes
Datamining 3rd naivebayessesejun
 
Datamining 2nd decisiontree
Datamining 2nd decisiontreeDatamining 2nd decisiontree
Datamining 2nd decisiontreesesejun
 
Datamining 7th kmeans
Datamining 7th kmeansDatamining 7th kmeans
Datamining 7th kmeanssesejun
 
100401 Bioinfoinfra
100401 Bioinfoinfra100401 Bioinfoinfra
100401 Bioinfoinfrasesejun
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclusteringsesejun
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rulesesejun
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rulesesejun
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclusteringsesejun
 
Datamining 7th Kmeans
Datamining 7th KmeansDatamining 7th Kmeans
Datamining 7th Kmeanssesejun
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4thsesejun
 
Datamining 6th Svm
Datamining 6th SvmDatamining 6th Svm
Datamining 6th Svmsesejun
 
Datamining 5th Knn
Datamining 5th KnnDatamining 5th Knn
Datamining 5th Knnsesejun
 

Mehr von sesejun (20)

次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習
 
20110602labseminar pub
20110602labseminar pub20110602labseminar pub
20110602labseminar pub
 
20110524zurichngs 2nd pub
20110524zurichngs 2nd pub20110524zurichngs 2nd pub
20110524zurichngs 2nd pub
 
20110524zurichngs 1st pub
20110524zurichngs 1st pub20110524zurichngs 1st pub
20110524zurichngs 1st pub
 
20110214nips2010 read
20110214nips2010 read20110214nips2010 read
20110214nips2010 read
 
Datamining 9th association_rule.key
Datamining 9th association_rule.keyDatamining 9th association_rule.key
Datamining 9th association_rule.key
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclustering
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svm
 
Datamining 3rd naivebayes
Datamining 3rd naivebayesDatamining 3rd naivebayes
Datamining 3rd naivebayes
 
Datamining 2nd decisiontree
Datamining 2nd decisiontreeDatamining 2nd decisiontree
Datamining 2nd decisiontree
 
Datamining 7th kmeans
Datamining 7th kmeansDatamining 7th kmeans
Datamining 7th kmeans
 
100401 Bioinfoinfra
100401 Bioinfoinfra100401 Bioinfoinfra
100401 Bioinfoinfra
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclustering
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rule
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rule
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclustering
 
Datamining 7th Kmeans
Datamining 7th KmeansDatamining 7th Kmeans
Datamining 7th Kmeans
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4th
 
Datamining 6th Svm
Datamining 6th SvmDatamining 6th Svm
Datamining 6th Svm
 
Datamining 5th Knn
Datamining 5th KnnDatamining 5th Knn
Datamining 5th Knn
 

Datamining r 4_5th

  • 2. SVM > iris.train <- read.table("iris_train.csv", sep=",", header=T) > iris.test <- read.table("iris_test.csv", sep=",", header=T) > library("e1071") > iris.model <- svm(iris.train[1:4], iris.train$Class) > iris.pred <- predict(iris.model, iris.test[1:4]) > table(iris.pred, iris.test$Class) iris.pred Iris-setosa Iris-versicolor Iris-virginica Iris-setosa 7 0 0 Iris-versicolor 0 9 0 Iris-virginica 0 0 14 2
  • 3. > iris.model <- svm(iris.train[1:4], iris.train$Class, kernel=”linear”) > iris.pred <- predict(iris.model, iris.test[1:4]) > table(iris.pred, iris.test$Class) iris.pred Iris-setosa Iris-versicolor Iris-virginica Iris-setosa 7 0 0 Iris-versicolor 0 9 0 Iris-virginica 0 0 14 3
  • 4. 4 1. USPS 1. USPS SVM radial 2. K-NN 3. SVM K-NN • 1 6 15:00 ( ) 4