[SOLVED] Number of Examples in Set
Hi,
I have data in ExampleSet like :
And now, I need to cut data, that every same name in specific ID is occurs max twice.
The wanted result is:
Is that possible in RapidMiner? Any regular expression or something.
Thanks,
Regards,
John
I have data in ExampleSet like :
ID | NAME | VALUE |
1 | Bob | 123.0 |
1 | Bob | 456.4 |
1 | Bob | 4786.4 |
1 | Alice | 333.4 |
1 | Brad | 88.4 |
2 | Jacob | 353.4 |
2 | Jacob | 663.4 |
2 | Jacob | 633.4 |
The wanted result is:
ID | NAME | VALUE |
1 | Bob | 123.0 |
1 | Bob | 456.4 |
1 | Alice | 333.4 |
1 | Brad | 88.4 |
2 | Jacob | 353.4 |
2 | Jacob | 663.4 |
Thanks,
Regards,
John
Find more posts tagged with
Sort by:
1 - 7 of
71

I tried a Loop Examples, but is exists something like condition if/else? Data value I extracted by Filter Examples Macro(data value) and if I said that the Example with name Bob is twice or more, then continue. Exists something like Continue operator and Counter operator?
Hi,
yes it is possible, but currently I can't think of a way of doing it without the "Execute Script" operator. Basically iterate over the sorted example set, count the number of same names, then flag every example which should be removed and afterwards remove all flagged examples.
Though you might want and try to come up with something clever using macros (as counter variables) and the "Branch" operator, it might very well be possible
Regards,
Marco
yes it is possible, but currently I can't think of a way of doing it without the "Execute Script" operator. Basically iterate over the sorted example set, count the number of same names, then flag every example which should be removed and afterwards remove all flagged examples.
Though you might want and try to come up with something clever using macros (as counter variables) and the "Branch" operator, it might very well be possible

Regards,
Marco
Wow,
Execution Script seems like a powerful tool. Thanks a lot. I wrote something like that:
Thanks,
Regards,
John
Execution Script seems like a powerful tool. Thanks a lot. I wrote something like that:
But it throws Exceptions, that something is wrong with method Remove (seems like a parser doesnt know her). Do you know, how can I remove an Example and at the end returns this new ExampleSet to output port? You were talking about flags. What do you mean?
ExampleSet exampleSet = operator.getInput(ExampleSet.class);
int instanceCounter = 0;
String lastValue;
int counter = 0;
for(Example example : exampleSet)
{
String value = example["InstanceID"];
if(lastValue == value)
instanceCounter++;
else
instanceCounter = 0;
if(instanceCounter >= 5)
exampleSet.remove(counter);
counter++;
lastValue = value;
}
operator.setOutput(exampleSet);
Thanks,
Regards,
John
Ok,
I have changed a method according to IOObject.remove(T class) implementation to exampleSet.remove(example) (from example above), and Exceptions are gone. But the Operator doesnt return the ExampleSet.
MODIFIED:
ok now, i can return the ExampleSet, but the method remove is wrong. Without remove method the process proceed well, but I need this method or similar to remove specific Example.
I have changed a method according to IOObject.remove(T class) implementation to exampleSet.remove(example) (from example above), and Exceptions are gone. But the Operator doesnt return the ExampleSet.
MODIFIED:
ok now, i can return the ExampleSet, but the method remove is wrong. Without remove method the process proceed well, but I need this method or similar to remove specific Example.