Pages: [1]
  Print  
Author Topic: Loop Label and Expressions.  (Read 747 times)
abcac
Newbie
*
Posts: 4


« on: August 10, 2012, 01:38:58 AM »

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?
Logged
abcac
Newbie
*
Posts: 4


« Reply #1 on: August 10, 2012, 02:36:59 AM »

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



WWW
« Reply #2 on: August 20, 2012, 09:29:43 AM »

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