RM5: How to run programatically an operator?
Hello,
I'm working on RM5. I've bought the "How to Extend RapidMiner 5.0 Whitepaper" but I have a doubt that is not aswered there.
I would like to run some operators inside another. In RM4.6 It was very easy to do it, just passing the IOObjects with the Apply method, put the operators in the right order and that's all.
Now with the ports I'm totally lost. I tried to run only an operator and the experiment was perfect. My problem is to execute 2 operators and how to link the info between them. I tried to put them separately, inside a Subprocess, and I wasn't able to make it work.
For example: Create an operator called MyOperator that receives an ExampleSet and delivers an ExampleSet with an ID and the ID column is renamed to "RandomID". It's a simple example and I would like to run first a GenetareID operator and after it a Rename operator. Now I'm able to run the GenerateID right but I have problems with the second operator.
I'm sure that It should not be so difficult but I don't have any example.
I'm working on RM5. I've bought the "How to Extend RapidMiner 5.0 Whitepaper" but I have a doubt that is not aswered there.
I would like to run some operators inside another. In RM4.6 It was very easy to do it, just passing the IOObjects with the Apply method, put the operators in the right order and that's all.
Now with the ports I'm totally lost. I tried to run only an operator and the experiment was perfect. My problem is to execute 2 operators and how to link the info between them. I tried to put them separately, inside a Subprocess, and I wasn't able to make it work.
For example: Create an operator called MyOperator that receives an ExampleSet and delivers an ExampleSet with an ID and the ID column is renamed to "RandomID". It's a simple example and I would like to run first a GenetareID operator and after it a Rename operator. Now I'm able to run the GenerateID right but I have problems with the second operator.
I'm sure that It should not be so difficult but I don't have any example.
0
Answers
-
Hi,
to me it looks like you don't want to run an operator "inside another" but rather after another, right? Programmatically, there are several ways to do this:
The one closest to the normal operator execution in RapidMiner is to connect the output ports to the input ports (InputPort.connect(OutputPort)) and then execute the operators subsequently.
The easiest way in your case is probably to use the method
ExampleSet apply(ExampleSet)
defined in PreprocessingOperator. Other types of operators have similar methods that can be used, bypassing the actual execute() and doWork() methods.
Best,
Simon0