K-means help

Hello, good afternoon. I would like to ask the following question, if anyone can help me.
Is there a way to access the cluster values to compare those values and to change the name of the cluster?
I need to compare if cluster 0 with its weight is less than the weight of cluster 1 and thus with a java snippet to be able to assign a certain name.
Thanks

Hello @DanielaQ,

welcome to KNIME Community!

If I got you right you would like to change cluster names created by k-Means node which are by default Cluster_o, Cluster_1… comparing exactly what? And perform that change in first output of k-Means node?

Br,
Ivan

1 Like

Thank you very much for your welcome !

Look, the second output of K-means shows the following:
image

Every time I run it, Cluster_0, Cluster_1, Cluster_2 are not the same logically. Sometimes Cluster_0 has the most weight and in others, it is Cluster_2 . I want to be able to take this output and compare the clusters, and whoever is high, example of the image Cluster_1 rename as “High”, the one that follows Cluster_2 “Medium” and finally Cluster_0 “Low”

hi @DanielaQ,

I also faced that “issue” in the past. Would be great to have an option of sorted clusters in case only one column is selected or to define the “sorting column”.

You have to use the “Rank” node (add your column and select “Ascending”) followed by “Rule Engine” and - if still necessary - the “RowID” node. Rule engine should look like this

Hope that helps, Greetz, Tommy

3 Likes

Hello @DanielaQ and @tommy,

I get it now. Have modified existing k-Means clustering example in a way that it adds defined Cluster Labels after clustering. Here is workflow:

Hope this helps!

Br,
Ivan

4 Likes

It worked ! Thank you very much for your time and help @ipazin @tommy

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.