Does Optimize Weights (Evolutionary) support nominal attributes?

Unknown
edited November 5 in Community Q&A
Hello

I get an "out of bounds" error when using the Optimize Weights (Evolutionary) operator if the example set contains a nominal attribute. I managed to create an example using generated data to show this. If you delete the attribute. or map it to a single, but pointless, value the process runs fine. Is this a bug and if so can anyone suggest a workaround?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.0">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" expanded="true" name="Process">
   <process expanded="true" height="512" width="993">
     <operator activated="true" class="generate_data" expanded="true" height="60" name="Generate Data" width="90" x="45" y="75">
       <parameter key="target_function" value="interaction classification"/>
       <parameter key="number_examples" value="1000"/>
       <parameter key="number_of_attributes" value="3"/>
     </operator>
     <operator activated="true" class="nominal_to_numerical" expanded="true" height="94" name="Nominal to Numerical" width="90" x="179" y="75">
       <parameter key="include_special_attributes" value="true"/>
     </operator>
     <operator activated="true" class="generate_attributes" expanded="true" height="76" name="Generate Attributes" width="90" x="313" y="75">
       <list key="function_descriptions">
         <parameter key="integer" value="ceil(rand()*3)"/>
       </list>
     </operator>
     <operator activated="true" class="numerical_to_polynominal" expanded="true" height="76" name="Numerical to Polynominal" width="90" x="447" y="75">
       <parameter key="attribute_filter_type" value="subset"/>
       <parameter key="attributes" value="integer|label"/>
       <parameter key="include_special_attributes" value="true"/>
     </operator>
     <operator activated="true" class="set_role" expanded="true" height="76" name="Set Role" width="90" x="581" y="75">
       <parameter key="name" value="label"/>
       <parameter key="target_role" value="label"/>
     </operator>
     <operator activated="true" class="map" expanded="true" height="76" name="Map" width="90" x="246" y="255">
       <parameter key="attribute_filter_type" value="subset"/>
       <parameter key="attributes" value="integer|label"/>
       <parameter key="include_special_attributes" value="true"/>
       <list key="value_mappings">
         <parameter key="1" value="one"/>
         <parameter key="2" value="two"/>
         <parameter key="3" value="three"/>
         <parameter key="0" value="zero"/>
       </list>
     </operator>
     <operator activated="true" class="optimize_weights_evolutionary" expanded="true" height="94" name="Optimize Weights (Evolutionary)" width="90" x="447" y="255">
       <process expanded="true">
         <operator activated="true" class="x_validation" expanded="true" height="112" name="Validation" width="90" x="179" y="210">
           <process expanded="true" height="505" width="447">
             <operator activated="true" class="naive_bayes_kernel" expanded="true" height="76" name="Naive Bayes (Kernel)" width="90" x="178" y="30"/>
             <connect from_port="training" to_op="Naive Bayes (Kernel)" to_port="training set"/>
             <connect from_op="Naive Bayes (Kernel)" from_port="model" to_port="model"/>
             <portSpacing port="source_training" spacing="0"/>
             <portSpacing port="sink_model" spacing="0"/>
             <portSpacing port="sink_through 1" spacing="0"/>
           </process>
           <process expanded="true" height="505" width="447">
             <operator activated="true" class="apply_model" expanded="true" height="76" name="Apply Model" width="90" x="88" y="25">
               <list key="application_parameters"/>
             </operator>
             <operator activated="true" class="performance" expanded="true" height="76" name="Performance" width="90" x="246" y="30"/>
             <connect from_port="model" to_op="Apply Model" to_port="model"/>
             <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
             <connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
             <connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
             <portSpacing port="source_model" spacing="0"/>
             <portSpacing port="source_test set" spacing="0"/>
             <portSpacing port="source_through 1" spacing="0"/>
             <portSpacing port="sink_averagable 1" spacing="0"/>
             <portSpacing port="sink_averagable 2" spacing="0"/>
           </process>
         </operator>
         <connect from_port="example set" to_op="Validation" to_port="training"/>
         <connect from_op="Validation" from_port="averagable 1" to_port="performance"/>
         <portSpacing port="source_example set" spacing="0"/>
         <portSpacing port="source_through 1" spacing="0"/>
         <portSpacing port="sink_performance" spacing="0"/>
       </process>
     </operator>
     <connect from_op="Generate Data" from_port="output" to_op="Nominal to Numerical" to_port="example set input"/>
     <connect from_op="Nominal to Numerical" 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_op="Numerical to Polynominal" to_port="example set input"/>
     <connect from_op="Numerical to Polynominal" from_port="example set output" to_op="Set Role" to_port="example set input"/>
     <connect from_op="Set Role" from_port="example set output" to_op="Map" to_port="example set input"/>
     <connect from_op="Map" from_port="example set output" to_op="Optimize Weights (Evolutionary)" to_port="example set in"/>
     <connect from_op="Optimize Weights (Evolutionary)" from_port="example set out" to_port="result 3"/>
     <connect from_op="Optimize Weights (Evolutionary)" from_port="weights" to_port="result 2"/>
     <connect from_op="Optimize Weights (Evolutionary)" from_port="performance" 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>
regards,

Andrew

Answers

  • land
    land New Altair Community Member
    Hi Andrew,
    this was a bug occurring with nominal attributes under certain circumstances. But it's a lucky day for you: Some enterprise customer demanded an update, so you will get the bugfix delivered freely this afternoon together with the next update of RapidMiner.

    Greetings,
      Sebastian