Generate Attributes has unexpected behavior with zero examples (or not?)

tennenrishintennenrishin Member Posts: 177 Contributor II
edited July 2019 in Help
In the example below, the expressions in the Generate Attributes operator have errors, but RM gives no error/warning message if the number of examples in the ExampleSet happens to be 0. Is this intended?
<?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="659" width="1059">
     <operator activated="true" class="generate_data_user_specification" compatibility="5.2.008" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="108" y="30">
       <list key="attribute_values">
         <parameter key="a" value="1"/>
       </list>
       <list key="set_additional_roles"/>
     </operator>
     <operator activated="true" class="filter_examples" compatibility="5.2.008" expanded="true" height="76" name="Filter Examples" width="90" x="246" y="30">
       <parameter key="invert_filter" value="true"/>
     </operator>
     <operator activated="true" class="generate_attributes" compatibility="5.2.008" expanded="true" height="76" name="Generate Attributes" width="90" x="380" y="30">
       <list key="function_descriptions">
         <parameter key="b" value="nonExistantAttribute+1"/>
         <parameter key="c" value="))()(A&lt;&lt;$&gt;++"/>
       </list>
     </operator>
     <connect from_op="Generate Data by User Specification" from_port="output" to_op="Filter Examples" to_port="example set input"/>
     <connect from_op="Filter Examples" from_port="example set 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>
Thanks,
Isak

Answers

  • tennenrishintennenrishin Member Posts: 177 Contributor II
    Related to the above, when there are no examples, Generate Attributes seems to type the generated attribute as nominal, even if the expression implies numerical type.

    Example:
    <?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="641" width="995">
         <operator activated="true" class="generate_data_user_specification" compatibility="5.2.008" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="112" y="75">
           <list key="attribute_values">
             <parameter key="x" value="1"/>
           </list>
           <list key="set_additional_roles"/>
         </operator>
         <operator activated="true" class="filter_examples" compatibility="5.2.008" expanded="true" height="76" name="Filter Examples" width="90" x="246" y="75">
           <parameter key="invert_filter" value="true"/>
         </operator>
         <operator activated="true" class="generate_attributes" compatibility="5.2.008" expanded="true" height="76" name="Generate Attributes" width="90" x="380" y="75">
           <list key="function_descriptions">
             <parameter key="y" value="x"/>
           </list>
         </operator>
         <connect from_op="Generate Data by User Specification" from_port="output" to_op="Filter Examples" to_port="example set input"/>
         <connect from_op="Filter Examples" from_port="example set 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="36"/>
         <portSpacing port="sink_result 2" spacing="18"/>
       </process>
     </operator>
    </process>
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Yes, the expression is not evaluated at all if there are no examples in the set. This is admittedly less than optimal, but given the current implementation, this is expected behaviour. Nevertheless I will open an internal bug report for this.

    Best, Marius
Sign In or Register to comment.