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


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 (, after clustering I might get something like this:
cluster 1:
cluster 2:
cluster 3:

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.


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