Orange Forum • View topic - hierarchical clustering -- samples listed by cluster number

hierarchical clustering -- samples listed by cluster number

A place to ask questions about methods in Orange and how they are used and other general support.

hierarchical clustering -- samples listed by cluster number

Postby brezeale » Sat Mar 31, 2007 23:20

Hi,

Is it (easily) possible to list the cluster number of training samples instead of the training samples themselves after performing hierarchical clustering? For example, using the training samples (["Ann", "Bob", "Curt", "Danny", "Eve", "Fred", "Greg", "Hue", "Ivy", "Jon"]) provided in your example (http://www.ailab.si/orange/doc/reference/clustering.htm), after clustering I might get something like this:
cluster 1:
Bob
Curf
cluster 2:
Ann
Danny
Jon
cluster 3:
Eve
Fred
Greg
Hue
Ivy

What I would like to get instead is just the cluster number for each sample with the order being the same as the original samples. So for the previous example, it would look like this:
2, 1, 1, 2, 3, 3, 3, 3, 3, 2

I tried playing around with the mapping attribute shown in the examples on the clustering page, but I was unable to produce the output in this form.

Thanks,
Darin

Postby Janez » Sun Jul 08, 2007 15:03

Cleaning up I noticed your question which nobody answered yet.

If you have a list of elements belonging to each cluster, what stops you from assigning a cluster number to each element yourself? If you have a function listOfClusters, as defined in an example in the documentation page you cited, you can continue with

Code: Select all
nid = orange.newmetaid()
for i, cluster in enumerate(listOfClusters(root)):
    for e in cluster:
        e[nid] = i


I haven't tried to run the code, but it should be something like this...


Return to Questions & Support



cron