The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Problem with Loop Attribute
Hi,
I want to calculate the average value for each attributes in Iris Data Set, so I use the Operator "Loop Attributes" and "Aggregate". But I get the Error Message: "The given example set does not contain an attribute a2."
just like in the picture
Why???
My Process is
blatoo
I want to calculate the average value for each attributes in Iris Data Set, so I use the Operator "Loop Attributes" and "Aggregate". But I get the Error Message: "The given example set does not contain an attribute a2."
just like in the picture
Why???
My Process is
Best Reguards!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.1.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.1.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="6.1.000" expanded="true" height="60" name="Retrieve Iris" width="90" x="112" y="30">
<parameter key="repository_entry" value="//Samples/data/Iris"/>
</operator>
<operator activated="true" class="loop_attributes" compatibility="6.1.000" expanded="true" height="76" name="Loop Attributes" width="90" x="313" y="30">
<parameter key="value_type" value="real"/>
<process expanded="true">
<operator activated="true" class="aggregate" compatibility="6.1.000" expanded="true" height="76" name="Aggregate" width="90" x="112" y="30">
<list key="aggregation_attributes">
<parameter key="%{loop_attribute}" value="average"/>
</list>
</operator>
<connect from_port="example set" to_op="Aggregate" to_port="example set input"/>
<connect from_op="Aggregate" 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="Retrieve Iris" 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>
blatoo
0
Answers
as a tip: You can set breakpoints before/after an operator to see what is going in/out by right-clicking on it, selecting one of the breakpoint options and then executing the process again.
You will notice if you add a breakpoint before your "Aggregate" operator that in the first iteration everything works as expected. However the second iteration fails because the input example set is no longer Iris but rather the one you generated via the previous execution of the "Aggregate" operator.
What happens in your process is:
You take a dataset and then loop over all its attributes. That means you loop 4 times (because you do not include special attributes in the Loop operator) and the iteration macro will be "a1", "a2", "a3" and finally "a4" when doing so. However when inside the loop, you modified the example set which then becomes the input for the next iteration and that is when it fails.
I think you had something else in mind when doing this, notice the subtle change of the connected output ports (inside the loop and outside the loop): Regards,
Marco
vielen Dank für die ausführliche Erklärung! Jetzt funktioniert alles!
Ich habe endlich kapiert, wann benutzt man "res" und wann "exa".
Viele Grüße
Blatoo
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.1.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.1.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="6.1.000" expanded="true" height="60" name="Retrieve Iris" width="90" x="112" y="30">
<parameter key="repository_entry" value="//Samples/data/Iris"/>
</operator>
<operator activated="true" class="aggregate" compatibility="6.1.000" expanded="true" height="76" name="Aggregate (2)" width="90" x="246" y="30">
<parameter key="use_default_aggregation" value="true"/>
<list key="aggregation_attributes"/>
</operator>
<connect from_op="Retrieve Iris" from_port="output" to_op="Aggregate (2)" to_port="example set input"/>
<connect from_op="Aggregate (2)" 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>
thanks very much for the suggestion! It is more easy.
Best Reguards
Blatoo