RapidMiner

RapidMiner

Loop Label and Expressions.

Contributor II

Loop Label and Expressions.

I have 10 attributes, 1 id, and 9 regular. I want to create 9 models, predicting each of the regular attributes with the other 8.

Loop Label seems appropriate, however models wont use special attributes as attributes. This means I need to change the role of the 7 other attributes to regular again.

How do you figure out if an attribute is the label?
2 REPLIES
Contributor II

Re: Loop Label and Expressions.

If you name your variables with a number on the end, you can use the Loop operator and do it manually.

Still I am not sure how to check if an attribute exists or not (in a branch).
Super Contributor

Re: Loop Label and Expressions.

Hi,

you can use Loop Attributes for this task. Just leave the role of all attributes at "regular" before passing the data into the loop. Then you can do something like the process below. You surely want to modify the sample process such that you log the performance or something inside the loop.

Best, Marius

[code<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
    <process expanded="true" height="190" width="547">
      <operator activated="true" class="generate_data" compatibility="5.2.008" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
      <operator activated="true" class="loop_attributes" compatibility="5.2.008" expanded="true" height="60" name="Loop Attributes" width="90" x="179" y="30">
        <process expanded="true" height="511" width="598">
          <operator activated="true" class="set_role" compatibility="5.2.008" expanded="true" height="76" name="Set Role" width="90" x="45" y="30">
            <parameter key="name" value="%{loop_attribute}"/>
            <parameter key="target_role" value="label"/>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="support_vector_machine" compatibility="5.2.008" expanded="true" height="112" name="SVM" width="90" x="179" y="30"/>
          <operator activated="true" class="set_role" compatibility="5.2.008" expanded="true" height="76" name="Set Role (2)" width="90" x="313" y="30">
            <parameter key="name" value="%{loop_attribute}"/>
            <list key="set_additional_roles"/>
          </operator>
          <connect from_port="example set" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="SVM" to_port="training set"/>
          <connect from_op="SVM" from_port="exampleSet" to_op="Set Role (2)" to_port="example set input"/>
          <connect from_op="Set Role (2)" from_port="example set output" to_port="example set"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="sink_example set" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Generate Data" from_port="output" to_op="Loop Attributes" to_port="example set"/>
      <connect from_op="Loop Attributes" from_port="example set" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>