The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[Solved] Ranking percentages by ID and label
Kate_Strydom
Member Posts: 19 Contributor II
in Help
Hi,
Can anyone assist me please!
I need to create a new attribute in RapidMiner called "Rank" which ranks the percentages in descending order grouped by the unique ID and Category.
unique ID Category Percentage Rank
001A News 0.23 1
001A Weather 0.15 2
001A Sports 0.09 3
001B Weather 0.64 1
001B News 0.25 2
001B Entertainment 0.02 3
Can anyone assist me please!
I need to create a new attribute in RapidMiner called "Rank" which ranks the percentages in descending order grouped by the unique ID and Category.
unique ID Category Percentage Rank
001A News 0.23 1
001A Weather 0.15 2
001A Sports 0.09 3
001B Weather 0.64 1
001B News 0.25 2
001B Entertainment 0.02 3
0
Answers
you can use Sort together with Generate ID to solve your problem. If you need to calculate the percentages first, you can use Aggregate.
Attached is a small process using the iris dataset and rank using the attribute a1.
I hope this helps!
Best,
Martin Edit: I overlooked that you want to do it grouped by your unique IDs. Here is an example process on sonar. The difference is basicly the loop
Dortmund, Germany
Thanks for the quick reply.
The problem is that it just replaces my Unique Id attribute with the generated ID, and no grouping takes place.
so I have operators
retrieve data - set role - sort by percentage - sort by unique ID - generate ID.
I need the generate ID to also group, instead of replace.
Thanks
Regards
Kate
i am not completly aware of your problem.
Am I right, that the generate ID operator "deletes" your UniqueID attribute? That might happen if the role of UniqueID is ID. Simply change the Role before to "something else". Then you can do the ranking. Afterwards set the role of UniqueID back to id.
Best,
Martin
Dortmund, Germany
I will try this.
I am trying to implement the script you sent. I used a execute script. pasted the edited code you sent in it. Linked it to the results. It gives an error - undefined macro: loop_value.
I presume I need to insert the loop value operator between sort and generate ID operator?
Will let you know how it works.
Regards
Kate
Dortmund, Germany
It still does not work
I must be doing something wrong. I also cannot see what the code you sent is supposed to do because of the error.
Please help.
Regards
Kate
Dortmund, Germany
Thank you so very much. I managed to follow your instructions.
Sorry I am so new and I did not see the red saying that your post had come through. Hence some of the communication is out of order.
I have successfully implemented the sonar code as per your instructions. I have also manage to successfully implement the code and the Loop value operator in my process. It is a very neat operator.
Your advice has been extremely helpful after I have spent so much time searching and trying to do this. I would never had succeeded without the loop value and the filter macro. Wish I understood how to implement this in other areas of my RapidMiner processes.
Regards
Kate
Great! It is always a pleasure to help.
There is some documentation around. E.g. https://rapidminer.com/documentation/ . I personally like the book "Data Mining for the masses" which is linked there. Furthermore there are several youtube sites etc. One of our consultants has his own youtube-channel. See: https://www.youtube.com/user/neuralmarkettrends1
But if you have further questions feel free to ask in this board.
Best,
Martin
Dortmund, Germany