🦉🦉   WOOT WOOT!   RAPIDMINER WISDOM 2020 EARLY BIRD REGISTRATION ENDS FRIDAY DEC 13!   REGISTER NOW!   🦉🦉

"[SOLVED] filtering with logical rules"

jan87jan87 Member Posts: 14 Contributor II
edited June 3 in Help
Hi,

I have some data of movements with the nominal attribute TYPE (values=foot, car, bike, ...) and the numeric attribute MAXSPEED
Now I just want to filter the examples due to some rules to drop off measure mistakes.

So I tried the operator "filter examples", but it can't handle like (TYPE=foot&&MAXSPEED<4) || (TYPE=car&&MAXSPEED<70) due to the parenthesis, I suppose...
Then I wanted to "generate an attribute", which is testing this conditions in "function expression" like  (TYPE==foot&&MAXSPEED<4) to filter afterwards, but it cant test the attribute value "foot"...

How can I filter the examples due to this rules?

Thanks a lot!
Tagged:

Answers

  • haddockhaddock Member Posts: 849  Guru
    Hi again,

    There are always alternative methods, but take a look at the following..
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.003">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
        <process expanded="true" height="222" width="820">
          <operator activated="true" class="generate_data" compatibility="5.2.003" expanded="true" height="60" name="Generate Data" width="90" x="45" y="75"/>
          <operator activated="true" class="generate_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="75">
            <list key="function_descriptions">
              <parameter key="bongo" value="if(att1&lt;0&amp;&amp;att2&lt;0,10,if(att3&gt;0&amp;&amp;att4&gt;0,20,0))"/>
            </list>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" 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>
    You can tell I like goal driven programming, working backwards from my intended destination. Do not do it, it drives you mad... ;D
  • jan87jan87 Member Posts: 14 Contributor II
    Yeah, thanks for that, actually I had no problem with this pure numeric values. But would you mind, showing the same testing in "Generate Attributes" with nominal attributes? Something like that:
    <?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="400" width="669">
          <operator activated="true" class="generate_nominal_data" compatibility="5.2.008" expanded="true" height="60" name="Generate Nominal Data" width="90" x="112" y="165"/>
          <operator activated="true" class="generate_attributes" compatibility="5.2.008" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="165">
            <list key="function_descriptions">
              <parameter key="bongo" value="if(att1==value1&amp;&amp;att2==value2,10)"/>
            </list>
          </operator>
          <connect from_op="Generate Nominal Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" 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>
  • haddockhaddock Member Posts: 849  Guru
    Hi,

    Don't want to sound grumpy, but this is a rare occasion when the help helps quite explicitly - you need double quotes, like this.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.003">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
        <process expanded="true" height="400" width="669">
          <operator activated="true" breakpoints="after" class="generate_nominal_data" compatibility="5.2.003" expanded="true" height="60" name="Generate Nominal Data" width="90" x="112" y="165"/>
          <operator activated="true" breakpoints="after" class="generate_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="165">
            <list key="function_descriptions">
              <parameter key="bongo" value="if(att1==&quot;value1&quot;&amp;&amp;att2==&quot;value2&quot;,10,0)"/>
            </list>
          </operator>
          <connect from_op="Generate Nominal Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" 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>

  • jan87jan87 Member Posts: 14 Contributor II
    Yes, you're right.
    Actually I tried this with double quotes, but the mistake had an other reason...  ::)
  • haddockhaddock Member Posts: 849  Guru
    Been there, wearing the T-shirt now! ;)
Sign In or Register to comment.