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

liming
liming New Altair Community Member
edited November 2024 in Community Q&A
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.
Tagged:

Best Answer

  • liming
    liming New Altair Community Member
    edited March 2019 Answer ✓
    Sorry, I wrongly click one button.

Answers

  • kayman
    kayman New Altair Community Member
    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.
  • liming
    liming New Altair Community Member
    edited March 2019 Answer ✓
    Sorry, I wrongly click one button.
  • liming
    liming New Altair Community Member
    How to make sure that my macro process runs before your expression is called?
  • kayman
    kayman New Altair Community Member
    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.
  • MartinLiebig
    MartinLiebig
    Altair Employee
    @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.
    Best,
    Martin
  • Edin_Klapic
    Edin_Klapic New Altair Community Member
    @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,
    Edin