Sorting by frequency distribution

JohnnyRapid
JohnnyRapid New Altair Community Member
edited November 2024 in Community Q&A

Hello, everyone,

I'm having a little problem preparing my records for a prediction right now. I have a list of production data with the installed quantities of parts (material numbers with N28 etc.). Each part can have different materials. In the table I have shown 4 parts as an example:

Unbenannt.PNG

 
Now I need a table where per product the materials are sorted by quantity in the row. So that I only have one line for each piece, where the material descriptions are listed in descending order:

 

Unbenannt2.PNG

 
It's probably easy, and I'm just being silly.

Best regards
Johnny

 

Tagged:

Best Answer

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    Answer ✓

    Hi!

     

    You're not silly, but it's a complicated problem.

     

    First, you would need the ranks of materials by ID. This kind of groupwise application is available in the RapidMiner Window Functions project. (Or you implement it yourself in a process with Loop Values, Filter, Sort, Generate Id etc.)

     

    Then you would use the Pivot operator with the Id as the grouping attribute and the newly created rank attribute as the index. This would give you a table like your example.

     

    Regards,

    Balázs

     

     

Answers

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    Answer ✓

    Hi!

     

    You're not silly, but it's a complicated problem.

     

    First, you would need the ranks of materials by ID. This kind of groupwise application is available in the RapidMiner Window Functions project. (Or you implement it yourself in a process with Loop Values, Filter, Sort, Generate Id etc.)

     

    Then you would use the Pivot operator with the Id as the grouping attribute and the newly created rank attribute as the index. This would give you a table like your example.

     

    Regards,

    Balázs

     

     

  • JohnnyRapid
    JohnnyRapid New Altair Community Member

    Hi Balázs

    Thanks for the advice. I will look at the RapidMiner Window Function project and try to apply it to my problem.

    I'll let you know if it worked.

    Many thanks
    Johnny

  • JohnnyRapid
    JohnnyRapid New Altair Community Member

    Thank you very much! With a little adjustment the ranking went smoothly for me.