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
increment filter example
Hi i'm new in rapidminer and have tried the possible ways to achieve my result but i'm having a hard time achieving it. How can I increment filter example? I'm working on a data set that gets the top 3 items per month. What i got to do is loop through the example set but my example filter is always in the month 1 only.
My example set
item id, month, sales
1, jan, 25
2 jan, 45
3, jan, 56
4, jan, 36
Expected result
3, jan, 56
2, jan, 45
4, jan, 36 and so on..
Tagged:
0
Best Answers
-
BalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 UnicornHi @jhiKI,
if I understand you correctly, you're trying to determine the top 3 entries of each month.
You could use Loop Values with the month attribute. In the loop you'd filter for the current month (loop_value macro), sort the result by sales descending, and Filter Example Range from 1 to 3. Then you would use Append to put the resulting collection together again.
It also works with the Database Envy extension which you can install from the Marketplace.
Here, you would use Generate Attribute to create the negSales attribute from sales with the formula "0 - sales". This is necessary because you want to sort by the sales and Database Envy can't yet sort descending. Then you use Apply Window Function: function: rank, group attributes: month, order attribute: negSales, value attribute: sales. This gives you the monthly rank of each entry (ties are possible), and you can use Filter examples to filter rank <= 3.
Regards,
Balázs
7 -
BalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 UnicornHi,
you don't need Set Macro in this process. Loop Values sets a macro to the value of the current iteration. You can access this macro value with %{loop_value} in Filter Examples.
Set Macro doesn't show you any attributes, that's how it is supposed to work. It just sets a macro value that you enter.
Extract Macro can be used to extract properties or values from example sets, but you don't need it here.
Regards,
Balázs5
Answers