Datamining R 5th

982 views
956 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
982
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Datamining R 5th

  1. 1. R: ( ) sesejun@is.ocha.ac.jp 2009/12/10
  2. 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. 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. 4. > 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> :
  5. 5. 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

×