[SOLVED] Forwarding Parameters from Operator to the next couple of Operators

minerchris
minerchris New Altair Community Member
edited November 5 in Community Q&A
Hi.

I'm using RapidMiner 4.6 (legacy project) and I have 3 extension operators (think of them as chained). The first one reads essentially runs an external tool to generate a specialized data set which is read back in ans passed along as ExampleSets. The train of operators do their job with the input ExampleSets and the results pop out on the end.

Now I need to enhance the 1st operator to pass along a ParameterSet (or whatever would be appropriate) with some values which will end up being used by the 3rd operator (possibly the 2nd as well).

I haven't had much luck with my testing so far. Without going into every single approach I've tried, in the 1st operator I collect my specialized information (these values are available to me in the 1st operator just after I run the external tool) and kind of cheat by creating a String of XML markup, then ParameterSet.readParameterSet(new ByteArrayInputStream(parameterMarkup.getBytes(this.getEncoding()))) it to create the ParameterSet object, which the operator apply() returns with the ExampleSets. e.g. return new IOObject[] { exampleSet1, exampleSet2, parameterSet };

The 1st operator's output classes are: [ ExampleSet.class, ExampleSet.class, ParameterSet.class ]

The 3rd operator (I've tested this with the 2nd operator as well) has ParameterTypes set for the ones I want the 1st operator to influence. I stuck some debug logging in the 2nd and 3rd operators to display what their perspective on the Parameter is.

Now, when I run the chain, I end up with a ParameterSet output to go along with the ExampleSets. (which is great!) The bad news is that although the ParameterSet operator and key are correctly displayed as the 3rd operator and it's naming of the parameter, the debug displayed indicates that the 3rd operator isn't using the ParamaterSet. e.g. "Operator1 Invoker.cleanup after run"

How do I pass specialized parameter information between operators? I've been pulling my hair out trying to make this actually work for over a day now.

Could it be the spaces in my operator names and parameters that are causing the problem?

Thank you!

Answers

  • minerchris
    minerchris New Altair Community Member
    OK! All I was missing was a regular ParameterSetter operator inserted after my 1st operator that creates the ParameterSet in the first place.

    I know I'm still on RM 4.6, but the tutorial is seriously lacking this basic example. (passing parameter along to other operators) The 2 tutorial examples use ParameterOptimization and GridParameterOptimization operators. Those work different and are for more advanced use cases than simply passing a parameter from an operator to another operator. Even a simple example 3 in where data is load, a parameter .par file is loaded with ParameterLoader, then set with ParameterSetter would help. Honestly I don't even remember why I tried using the ParameterSetter operator. I'm sure the tutorial documentation has the answer in there somewhere, an example would have made it clear.