Options

problem on loop attribute subsets

philipsphilips Member Posts: 2 Contributor I
edited September 2019 in Help
I need to conduct experiment using loop attribute subsets, but I do not need all combination of the subsets.
The experiments just need to add one attribute for every iteration.
For example: we have 10 attributes (attr_1, attr_2, ..., attr_10).
We only need to run a model on attr_1, {attr_1, attr_2}, {attr_1, ... attr_3}, ..., {attr_1, attr_2, ..., attr_10}
Is it possible to conduct such experiments in RapidMiner?

Answers

  • Options
    haddockhaddock Member Posts: 849 Maven
    Hola,

    Here's the outline of an answer, it runs in the reverse order to your requests, because it starts with all attributes, and trashes the last one at each iteration. I've stuck a break in the loop to make the point, so just keep pressing on  ;D

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input>
          <location/>
        </input>
        <output>
          <location/>
        </output>
        <macros/>
      </context>
      <operator activated="true" class="process" expanded="true" name="Process">
        <process expanded="true" height="391" width="915">
          <operator activated="true" class="generate_data" expanded="true" height="60" name="Generate Data" width="90" x="88" y="121"/>
          <operator activated="true" class="loop_attributes" expanded="true" height="60" name="Loop Attributes" width="90" x="380" y="75">
            <process expanded="true" height="391" width="915">
              <operator activated="true" class="extract_macro" expanded="true" height="60" name="Extract Macro" width="90" x="179" y="75">
                <parameter key="macro" value="atts"/>
                <parameter key="macro_type" value="number_of_attributes"/>
              </operator>
              <operator activated="true" breakpoints="before" class="remove_attribute_range" expanded="true" height="76" name="Remove Attribute Range" width="90" x="380" y="120">
                <parameter key="first_attribute" value="%{atts}"/>
                <parameter key="last_attribute" value="%{atts}"/>
              </operator>
              <connect from_port="example set" to_op="Extract Macro" to_port="example set"/>
              <connect from_op="Extract Macro" from_port="example set" to_op="Remove Attribute Range" to_port="example set input"/>
              <connect from_op="Remove Attribute Range" 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"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
  • Options
    philipsphilips Member Posts: 2 Contributor I
    It's worked. Thank you very much.  :)
Sign In or Register to comment.