Options

[SOLVED] classification of the values ​​of the cluster attribute

imfaithimfaith Member Posts: 14 Contributor II
edited November 2018 in Help
Hi ,
I used this code to know for each data belongs to which cluster.

for (Example example : resultSet){
Attribute clusterAttribute = resultSet.getAttributes().getCluster();
double value = resultSet.getAttributes().getCluster().getValue(example.getDataRow());
System.out.println(value)
it  gave me the results as follows:

0.0  => i.e the data in  this row belong to cluster_6 (see code below)
1.0 => i.e the data in  this row belong to cluster_1
0.0
2.0 => i.e  the data in  this row belong to cluster_0
3.0
4.0
4.0
...
index corresponds to which cluster the data belongs in this rang. I am looking for the existance for other better solutions. what worries me is that I do not know at earlier classification of clusters. For example : the value of cluster  attribute in my process is :
values ​​= [cluster_6, cluster_1, cluster_0, cluster_4, cluster_2, cluster_3, cluster_5]
I want it to be ordered by starting with the cluster_0  until to cluster_6. Hence the index 0.0 indicates cluster_0.
Best regards.
Tagged:

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Even though it may be possible, we did not design a way to reorder the mapping of double values to strings. However, you can easily get the translation by using the nominal mapping:
    String cluster = clusterAttribute.getNominalMapping().mapIndex(clusterAttribute.getValue(example.getDataRow()))

    Best, Marius
  • Options
    imfaithimfaith Member Posts: 14 Contributor II
    Thank you very much.
Sign In or Register to comment.