Blogger Tips and TricksLatest Tips And TricksBlogger Tricks

Hierarchical Clustering Algorithm Implementation in weka tool

Procedure:
Step1: Open the data file in Weka Explorer. It is presumed that the required data fields have been discretized. In this example it is age attribute.
Step2: Clicking on the associate tab will bring up the interface for association rule algorithm.
Step3: We will use Hierarchical clustering algorithm. This is the default algorithm.

Step4: Inorder to change the parameters for the run (example support, confidence etc) we click on the text box immediately to the right of the choose button.



=== Run information ===

Scheme:       weka.clusterers.HierarchicalClusterer -N 3 -L COMPLETE -P -A "weka.core.EuclideanDistance -R first-last"
Relation:     iris
Instances:    150
Attributes:   5
              sepallength
              sepalwidth
              petallength
              petalwidth
Ignored:
              Class

Test mode:    Classes to clusters evaluation on training data

=== Clustering model (full training set) ===

Cluster 0
((((((((0.2:0.03254,0.2:0.03254):0.01754,0.2:0.05008):0.05008,(0.2:0.06514,(0.3:0.03254,0.3:0.03254):0.0326):0.03501):0.0627,((0.2:0.08429,0.2:0.08429):0.01868,0.4:0.10296):0.05989):0.05998,((0.5:0.06731,0.4:0.06731):0.03138,0.6:0.09869):0.12414):0.0426,(((0.3:0.10956,(0.2:0.05085,0.2:0.05085):0.05872):0.0457,(((0.2:0.02778,0.2:0.02778):0.02509,0.2:0.05287):0.04863,0.2:0.1015):0.05377):0.04789,0.2:0.20316):0.06227):0.27986,(((((0.4:0.0678,0.4:0.0678):0.05473,0.3:0.12253):0.00773,(0.2:0.02778,0.2:0.02778):0.10248):0.04974,((0.3:0.04498,0.2:0.04498):0.05264,(0.4:0.07958,0.4:0.07958):0.01804):0.08238):0.15593,((0.2:0.18394,(0.1:0.10346,0.2:0.10346):0.08048):0.04087,0.4:0.22481):0.11112):0.20936):0.39259,((((((0.2:0.04383,0.2:0.04383):0.03345,0.3:0.07728):0.02141,(((0.1:0,0.1:0):0,0.1:0):0.05287,0.1:0.05287):0.04582):0.04428,((0.2:0.03254,0.2:0.03254):0.04474,(0.2:0.05808,(0.2:0.05008,0.2:0.05008):0.00801):0.01919):0.06569):0.0732,(((0.2:0.04498,0.2:0.04498):0.03766,0.1:0.08264):0.0435,0.2:0.12614):0.09002):0.16859,0.3:0.38475):0.55313)

Cluster 1
(((((1.4:0.10206,(1.5:0.06508,1.5:0.06508):0.03698):0.1195,((1.5:0.09914,(1.3:0.08779,1.4:0.08779):0.01135):0.04781,(1.4:0.05008,1.4:0.05008):0.09688):0.07461):0.14269,((((1.5:0.07344,1.6:0.07344):0.07157,1.6:0.145):0.08347,(1.8:0.10158,((1.8:0.03254,1.8:0.03254):0.03254,1.8:0.06508):0.0365):0.1269):0.07755,((1.5:0.11722,((1.4:0.04498,1.4:0.04498):0.02233,1.5:0.06731):0.04991):0.06399,((1.3:0.10614,(1.3:0.05556,1.3:0.05556):0.05059):0.01961,1.2:0.12575):0.05546):0.12481):0.05823):0.19886,(((((1.5:0.12951,(1.6:0.10206,1.5:0.10206):0.02745):0.01413,1.4:0.14365):0.09836,((1.9:0.1015,1.9:0.1015):0.03736,(1.8:0.05287,1.8:0.05287):0.08599):0.10315):0.01446,1.8:0.25646):0.18476,((((1.9:0,1.9:0):0.08779,2.0:0.08779):0.04137,2.0:0.12917):0.08329,2.4:0.21246):0.22877):0.12189):0.22922,(((((1.3:0.08333,1.3:0.08333):0.14148,1.0:0.22481):0.04376,((1.5:0.09869,1.3:0.09869):0.06245,1.5:0.16114):0.10743):0.16671,(((((1.3:0.0678,(1.3:0.04498,1.3:0.04498):0.02281):0.04316,(1.3:0.05287,1.2:0.05287):0.05809):0.04851,(1.5:0.05556,1.5:0.05556):0.10391):0.05135,(1.4:0.15366,1.3:0.15366):0.05716):0.14282,(((1.0:0.0947,(1.2:0.04498,1.2:0.04498):0.04972):0.04314,(1.2:0.07344,1.3:0.07344):0.0644):0.06016,((1.1:0.07344,(1.1:0.04498,1.0:0.04498):0.02845):0.04637,1.0:0.1198):0.0782):0.15564):0.08165):0.0877,((((1.0:0.05008,1.0:0.05008):0.05964,1.1:0.10972):0.1207,1.0:0.23042):0.16704,1.7:0.39746):0.12553):0.26934)

Cluster 2
(((((1.7:0.16107,(2.0:0.08504,2.0:0.08504):0.07603):0.02014,(1.8:0.08946,(1.8:0.05008,1.8:0.05008):0.03938):0.09175):0.08209,((2.1:0.10956,(2.1:0.05287,2.1:0.05287):0.0567):0.11196,(2.2:0.10296,(2.1:0.04167,2.2:0.04167):0.0613):0.11857):0.04178):0.14634,((2.5:0.15339,(2.3:0.10972,(2.4:0.06047,2.3:0.06047):0.04924):0.04367):0.10143,(((((2.3:0.04383,2.3:0.04383):0.03891,2.4:0.08274):0.02574,2.5:0.10848):0.05819,2.1:0.16667):0.00582,(2.3:0.07148,2.3:0.07148):0.101):0.08234):0.15482):0.20073,(((((2.1:0.09869,2.0:0.09869):0.0653,(1.8:0.07344,1.9:0.07344):0.09055):0.11401,(1.8:0.12263,1.6:0.12263):0.15537):0.13054,(2.3:0.21486,2.3:0.21486):0.19367):0.11672,(2.5:0.30123,(2.2:0.11232,2.0:0.11232):0.18891):0.22402):0.08512)



Time taken to build model (full training data) : 0.02 seconds

=== Model and evaluation on training set ===

Clustered Instances

0       50 ( 33%)
1       66 ( 44%)
2       34 ( 23%)


Class attribute: class
Classes to Clusters:

  0  1  2  <-- assigned to cluster
 50  0  0 | Iris-setosa
  0 49  1 | Iris-versicolor
  0 17 33 | Iris-virginica

Cluster 0 <-- Iris-setosa
Cluster 1 <-- Iris-versicolor
Cluster 2 <-- Iris-virginica

Incorrectly clustered instances :    18.0       12      %



1 comment:

Flag Counter