Set Roles By Parameter Names

dragoljubdragoljub Member Posts: 241 Contributor II
edited June 2019 in Help
Hi RapidMiner Gurus!

I have been working with data sets that come with a lot of meta-data. It would be great if there was an operator that assigns multiple special attribute roles equal to their name. ;D

Let's say you have 30 Meta Data columns and would like them to be assigned special roles to be passed through operators but not treated as labels or regular parameters. Today we have "Set Role" which allows setting one by one but it would be great if there was a way to assign by a filtered list or regular expression.

Thanks,
-Gagi

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Gagi,

    you can use Loop Attributes for that. Please have a look at the attached process.

    Best, Marius
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
        <process expanded="true" height="562" width="718">
          <operator activated="true" class="generate_data" compatibility="5.3.000" expanded="true" height="60" name="Generate Data" width="90" x="99" y="28"/>
          <operator activated="true" class="loop_attributes" compatibility="5.3.000" expanded="true" height="76" name="Loop Attributes" width="90" x="266" y="29">
            <process expanded="true" height="562" width="718">
              <operator activated="true" class="set_role" compatibility="5.3.000" expanded="true" height="76" name="Set Role" width="90" x="188" y="31">
                <parameter key="name" value="%{loop_attribute}"/>
                <parameter key="target_role" 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_port="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
              <portSpacing port="sink_result 1" 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>
Sign In or Register to comment.