How to get a value from the output of a operator in RapidMiner?

limingliming Member Posts: 13 Contributor I
I want to get a value from the output of a operator in RapidMiner, and input the value into the parameter of expression of another operator.
My process XML is attached below. 
The picture corresponding to the XML is as following,

The output of the Aggregate operator is as following,

The paramenter needed in Generate Attributes operator is as following,

The parameters "90" needing to be set in the Generate Attributes operator correspond to the "90" in the above picture.
I want to know whether the "90" induced by the Aggregate operator can be passed to Generator Attribute operator. Now I set the parameter "90" manually. I hope that this process does not require manual intervention.

Best Answer

  • limingliming Member Posts: 13 Contributor I
    edited March 2019 Solution Accepted
    Sorry, I wrongly click one button.


  • kaymankayman Member Posts: 662 Unicorn
    You can use macro's to achieve this. You may need to add some extra operators but this would be one possible way to achieve this : 

    After your aggregate add an additional filter operator, and filter on 'class=outlier', you can keep the rest of the process as is, just use the original output of the filter operator to continue your current process.

    On the filter output you now add an extract macro operator, select data value as type and set example index to 1. Under attribute name you set 'class' and name the macro like outlier. This basically stores the value of the filtered class (in this case your outlier) and keeps it in memory.

    Now you can change your expression to if(id<%{outlier},"outlier","normal") and the value will automatically change without further human impact needed.

    Note that it is important that your macro process runs before your expression is called.
  • limingliming Member Posts: 13 Contributor I
    How to make sure that my macro process runs before your expression is called?
  • kaymankayman Member Posts: 662 Unicorn
    Click the icon with the blue box and transparant boxes behind them. These show your order. Now you can select your operators and define the order (use right click for contextual info). It's getting a bit used to but once you get the trick it's pretty easy to set your order.
  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,453 RM Data Scientist
    @kayman @liming,
    alternatively, I love to add "Delay" operators with a Delay of 0. It has port extenders on both sides and you can thus ensure that an operator needs to be executed before. Kind of handy trick I learned from @Edin_Klapic.
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 299 RM Data Scientist
    @mschmitz Thanks for the praise :)
    In case you have an Operator which has no input port (like the Retrieve Operator) you can put it into a subprocess which basically has the same functionality. Delay has the advantage of being able to stay in the same "layer".
    Happy Mining,
Sign In or Register to comment.