Pages: [1]
  Print  
Author Topic: Set Roles By Parameter Names  (Read 791 times)
dragoljub
Full Member
***
Posts: 246


« on: September 24, 2012, 08:51:56 PM »

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. Grin

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
Logged
Marius
Administrator
Hero Member
*****
Posts: 1793



WWW
« Reply #1 on: September 26, 2012, 10:53:02 AM »

Hi Gagi,

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

Best, Marius

Code:
<?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>
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
Pages: [1]
  Print  
 
Jump to: