Feature Request....Filter example range....select last x records

hughesfleming68
New Altair Community Member
This is one operator that I use all the time. It is especially handy to chop off the beginning of a data set by selecting record 1 -> x and hitting invert. It is on the other hand much more involved to do from the other end of the data set. It can be done in python in one line. df = df.tail(x). Unless I have missed something all these years, I have been counting records and then building macros to create a window for the last x records. Can we have an easier/faster way to do this? I know you can sort, apply the filter and sort back but the filter example range operator should be able to work on both ends of the dataset.
regards,
Alex
regards,
Alex
0
Best Answer
-
Hi Janito, you need to break the problem down into pieces. The following process will do what you want. When you construct a process like this, you need to be careful of the order of the operators. Make sure that your macros are set first before you do any filtering. Let me know if this solves your problem.
regards,
Alex
Edit....I uploaded a correction. There was one extra operator that was not needed. Both rmp files should work. The smaller one is the correct one.
1
Answers
-
Hi Alex,
One pretty fast workaround to do that might be using EXTRACT MACRO operator and generate macro of type "number_of_examples" which then can be used in FILTER EXAMPLE RANGE operator.
1 -
Thanks kypexin. That is how I do it now using macros. I am suggesting that it should be part of the filter example range operator and as simple as it is to do in python. I agree, your suggestion is the best way to it.1
-
Thanks kypexin. That is how I do it now using macros. I am suggesting that it should be part of the filter example range operator and as simple as it is to do in python. I agree, your suggestion is the best way to it.
Hey Alex,
can you please show me an example? Iam currently stucked with this problem.
I want to erase the last examples of my database which doesnt contain a specific value. I tried to generate two macros and use filter range, but the number of rows is different in every of my tables.Attached you will find my sample data.
Now I want to erase every example after my example value "D". I tought about using a "if then else" cause, but iam pretty new to RapidMiner and it isnt working well.
Maybe somebody can help me please?`Greetings
Janito
0 -
2
-
Hey Martin,thank you for your response! My input data will be different every time, so next time the value "D" might be in the place of ID 8 or 5. Thats why I was looking for a way to use "if then else" to determine the last value "D" in my data and cut the rest below from my list.0
-
Hi Janito, you need to break the problem down into pieces. The following process will do what you want. When you construct a process like this, you need to be careful of the order of the operators. Make sure that your macros are set first before you do any filtering. Let me know if this solves your problem.
regards,
Alex
Edit....I uploaded a correction. There was one extra operator that was not needed. Both rmp files should work. The smaller one is the correct one.
1 -
Hey Alex,
thank you for your answer! You helped me to solve this problem.
Have a nice day.
Greets
Janito
1