SlideShare une entreprise Scribd logo
1  sur  7
R:

    (          )



sesejun@is.ocha.ac.jp
     2009/12/10
k-means
> usps<-read.table("usps/usps_cluster.csv", header=T, sep=",")
> usps.sub<-usps[3:length(usps)]



> rownames(usps.sub)<-usps$ImageName



> usps.kmeans<-kmeans(usps.sub, 3, iter.max=100)
> usps.kmeans$size
[1] 5 2 3
> usps.kmeans$cluster
 [1] 2 3 3 1 1 2 3 1 1 1


> usps.kmeans
> usps.dist<-dist(usps.sub, method="euclidean")


> usps.dist
              img_0_00_00 img_1_00_00 img_2_00_00 img_3_00_00
img_1_00_00      2517.392
img_2_00_00      2172.201    2204.662
img_3_00_00      2073.739    2128.806    2225.389
img_4_00_00      2239.165    1915.576    2220.492    1928.101
img_5_00_00      1981.039    2472.299    2179.280    2400.684
...
> usps.hclust<-hclust(usps.dist,method="single")
> plot(usps.hclust)
> library(cluster)
> usps.div<-diana(usps.sub, metric="euclidian",stand=TRUE)


> print(usps.div)
Merge:
       [,1] [,2]
 [1,]    -8 -10
 [2,]    -2   -7
 [3,]    -4   -5
 [4,]     1   -9
...

> plot(usps.div)

                    <Return>            :
                    <Return>            :
1. k-means          usps_cluster_large.tab           k
                                         k 5

     •   usps_cluster_large.tab       0        9           5   50

2.                                                 DIANA
     usps_cluster_large.tab




     •   1,2

3.

•              1   29

Contenu connexe

Plus de sesejun

RNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A ReviewRNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A Reviewsesejun
 
バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析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 r 4th
Datamining r 4thDatamining r 4th
Datamining r 4thsesejun
 
Datamining r 3rd
Datamining r 3rdDatamining r 3rd
Datamining r 3rdsesejun
 
Datamining r 2nd
Datamining r 2ndDatamining r 2nd
Datamining r 2ndsesejun
 
Datamining r 1st
Datamining r 1stDatamining r 1st
Datamining r 1stsesejun
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svmsesejun
 
Datamining 5th knn
Datamining 5th knnDatamining 5th knn
Datamining 5th knnsesejun
 
Datamining 4th adaboost
Datamining 4th adaboostDatamining 4th adaboost
Datamining 4th adaboostsesejun
 
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
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclusteringsesejun
 

Plus de sesejun (20)

RNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A ReviewRNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A Review
 
バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析
 
次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習
 
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 r 4th
Datamining r 4thDatamining r 4th
Datamining r 4th
 
Datamining r 3rd
Datamining r 3rdDatamining r 3rd
Datamining r 3rd
 
Datamining r 2nd
Datamining r 2ndDatamining r 2nd
Datamining r 2nd
 
Datamining r 1st
Datamining r 1stDatamining r 1st
Datamining r 1st
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svm
 
Datamining 5th knn
Datamining 5th knnDatamining 5th knn
Datamining 5th knn
 
Datamining 4th adaboost
Datamining 4th adaboostDatamining 4th adaboost
Datamining 4th adaboost
 
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
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclustering
 

Datamining R 5th

  • 1. R: ( ) sesejun@is.ocha.ac.jp 2009/12/10
  • 2. k-means > usps<-read.table("usps/usps_cluster.csv", header=T, sep=",") > usps.sub<-usps[3:length(usps)] > rownames(usps.sub)<-usps$ImageName > usps.kmeans<-kmeans(usps.sub, 3, iter.max=100) > usps.kmeans$size [1] 5 2 3 > usps.kmeans$cluster [1] 2 3 3 1 1 2 3 1 1 1 > usps.kmeans
  • 3. > usps.dist<-dist(usps.sub, method="euclidean") > usps.dist img_0_00_00 img_1_00_00 img_2_00_00 img_3_00_00 img_1_00_00 2517.392 img_2_00_00 2172.201 2204.662 img_3_00_00 2073.739 2128.806 2225.389 img_4_00_00 2239.165 1915.576 2220.492 1928.101 img_5_00_00 1981.039 2472.299 2179.280 2400.684 ... > usps.hclust<-hclust(usps.dist,method="single") > plot(usps.hclust)
  • 4.
  • 5. > library(cluster) > usps.div<-diana(usps.sub, metric="euclidian",stand=TRUE) > print(usps.div) Merge: [,1] [,2] [1,] -8 -10 [2,] -2 -7 [3,] -4 -5 [4,] 1 -9 ... > plot(usps.div) <Return> : <Return> :
  • 6.
  • 7. 1. k-means usps_cluster_large.tab k k 5 • usps_cluster_large.tab 0 9 5 50 2. DIANA usps_cluster_large.tab • 1,2 3. • 1 29