"[SOLVED] filtering with logical rules"
jan87
New Altair Community Member
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!
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!
0
Answers
-
Hi again,
There are always alternative methods, but take a look at the following..<?xml version="1.0" encoding="UTF-8" standalone="no"?>
You can tell I like goal driven programming, working backwards from my intended destination. Do not do it, it drives you mad... ;D
<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<0&&att2<0,10,if(att3>0&&att4>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>0 -
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&&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>0 -
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=="value1"&&att2=="value2",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>
0 -
Yes, you're right.
Actually I tried this with double quotes, but the mistake had an other reason... ::)0 -
Been there, wearing the T-shirt now!0