"Nested macros"
Hi!
I have an example set with different attributes and a class. For all regular attributes I want to calculate the average of examples labled false. Then I want to use this averages and calculate for every example the difference to this average.
I planned to use a feature iterator (over all false examples) to calculate all averages and store them in macros. Then i wanted to use another feature iterator (over all examples) to calculate the difference in an AttributeConstruction:
I would also be happy about a totally different solution. (Please consider that I'm dealing with about 4000 attributes which are not known jet. So assigning individual names is not possible).
I have an example set with different attributes and a class. For all regular attributes I want to calculate the average of examples labled false. Then I want to use this averages and calculate for every example the difference to this average.
I planned to use a feature iterator (over all false examples) to calculate all averages and store them in macros. Then i wanted to use another feature iterator (over all examples) to calculate the difference in an AttributeConstruction:
The problem is this line:
<operator name="Calculate Averages" class="OperatorChain" expanded="no">
<operator name="Work on copy" class="IOMultiplier">
<parameter key="io_object" value="ExampleSet"/>
</operator>
<operator name="Only non-pain" class="ExampleFilter">
<parameter key="condition_class" value="attribute_value_filter"/>
<parameter key="parameter_string" value="pain=no"/>
</operator>
<operator name="For All Distances and Angles" class="FeatureIterator" expanded="no">
<parameter key="filter" value="dist.*|angle.*"/>
<operator name="Calculate Average" class="DataMacroDefinition">
<parameter key="macro" value="avg_%{loop_feature}"/>
<parameter key="macro_type" value="statistics"/>
<parameter key="attribute_name" value="%{loop_feature}"/>
</operator>
</operator>
<operator name="Delete Copy" class="IOConsumer">
<parameter key="io_object" value="ExampleSet"/>
<parameter key="deletion_type" value="delete_one"/>
</operator>
</operator>
<operator name="Calculate Relations" class="OperatorChain" expanded="yes">
<operator name="For All Distances and Angles (2)" class="FeatureIterator" expanded="yes">
<parameter key="filter" value="whatever.*"/>
<parameter key="work_on_input" value="false"/>
<operator name="AttributeConstruction" class="AttributeConstruction">
<list key="function_descriptions">
<parameter key="%{loop_feature}_Quotient" value="%{avg_%{loop_feature}}"/>
</list>
</operator>
</operator>
</operator>
<parameter key="%{loop_feature}_Quotient" value="%{avg_%{loop_feature}}"/>I get an UserError: SyntaxError. By now I know that is is obviously not possible to have an macro in a macro name. How can I come over this problem?
I would also be happy about a totally different solution. (Please consider that I'm dealing with about 4000 attributes which are not known jet. So assigning individual names is not possible).
Find more posts tagged with
Sort by:
1 - 1 of
11
here's a total different solution
Sebastian