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

[Solved]Extract Misclassified Examples

aryan_hosseinzaaryan_hosseinza Member Posts: 74 Contributor II
Hi ,

I am using a cross validation and I want to extract those examples which are misclassified , how may I do it in rapidminer ?


Thanks ,
Arian

<?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="738" width="1907">
     <operator activated="true" class="read_csv" compatibility="5.2.008" expanded="true" height="60" name="Read CSV" width="90" x="45" y="120">
       <parameter key="csv_file" value="/home/arian/RM/result/dataSet_Nominal_10PercentRandomSample"/>
       <parameter key="column_separators" value=","/>
       <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
       <list key="annotations"/>
       <list key="data_set_meta_data_information"/>
     </operator>
     <operator activated="true" class="select_attributes" compatibility="5.2.008" expanded="true" height="76" name="Select Attributes" width="90" x="179" y="120">
       <parameter key="attribute_filter_type" value="single"/>
       <parameter key="attribute" value="admit"/>
       <parameter key="attributes" value="|admit"/>
       <parameter key="invert_selection" value="true"/>
     </operator>
     <operator activated="true" class="date_to_numerical" compatibility="5.2.008" expanded="true" height="76" name="Date to Numerical" width="90" x="313" y="120">
       <parameter key="attribute_name" value="discharge"/>
       <parameter key="time_unit" value="year"/>
     </operator>
     <operator activated="true" class="numerical_to_polynominal" compatibility="5.2.008" expanded="true" height="76" name="Numerical to Polynominal" width="90" x="447" y="120">
       <parameter key="attribute_filter_type" value="single"/>
       <parameter key="attribute" value="discharge"/>
     </operator>
     <operator activated="true" class="set_role" compatibility="5.2.008" expanded="true" height="76" name="Set Role" width="90" x="581" y="120">
       <parameter key="name" value="event"/>
       <parameter key="target_role" value="label"/>
       <list key="set_additional_roles"/>
     </operator>
     <operator activated="true" class="select_attributes" compatibility="5.2.008" expanded="true" height="76" name="Nominal_Gini_top18" width="90" x="715" y="120">
       <parameter key="attribute_filter_type" value="subset"/>
       <parameter key="attribute" value="age"/>
       <parameter key="attributes" value="|age|d_04173|prev_readmissions|num_diags|num_drugs|los|p_14|i_9985|d_08021|d_07891|d_09919|d_47186|d_47146|d_37950|p_12|d_02847|d_47234|day_30_readmits"/>
     </operator>
     <operator activated="true" class="x_validation" compatibility="5.2.008" expanded="true" height="130" name="Validation" width="90" x="849" y="120">
       <parameter key="number_of_validations" value="3"/>
       <parameter key="use_local_random_seed" value="true"/>
       <parameter key="parallelize_training" value="true"/>
       <parameter key="parallelize_testing" value="true"/>
       <process expanded="true" height="629" width="882">
         <operator activated="true" class="multiply" compatibility="5.2.008" expanded="true" height="94" name="Multiply" width="90" x="45" y="30"/>
         <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="condition_class" value="attribute_value_filter"/>
           <parameter key="parameter_string" value="event=f"/>
         </operator>
         <operator activated="true" class="sample" compatibility="5.2.008" expanded="true" height="76" name="Sample" width="90" x="380" y="30">
           <parameter key="sample" value="relative"/>
           <parameter key="sample_ratio" value="0.1315"/>
           <list key="sample_size_per_class"/>
           <list key="sample_ratio_per_class"/>
           <list key="sample_probability_per_class"/>
           <parameter key="use_local_random_seed" value="true"/>
         </operator>
         <operator activated="true" class="filter_examples" compatibility="5.2.008" expanded="true" height="76" name="Filter Examples (2)" width="90" x="246" y="345">
           <parameter key="condition_class" value="attribute_value_filter"/>
           <parameter key="parameter_string" value="event=t"/>
         </operator>
         <operator activated="true" class="append" compatibility="5.2.008" expanded="true" height="94" name="Append" width="90" x="514" y="255"/>
         <operator activated="true" class="naive_bayes" compatibility="5.2.008" expanded="true" height="76" name="Naive Bayes" width="90" x="648" y="255"/>
         <connect from_port="training" to_op="Multiply" to_port="input"/>
         <connect from_op="Multiply" from_port="output 1" to_op="Filter Examples" to_port="example set input"/>
         <connect from_op="Multiply" from_port="output 2" to_op="Filter Examples (2)" to_port="example set input"/>
         <connect from_op="Filter Examples" from_port="example set output" to_op="Sample" to_port="example set input"/>
         <connect from_op="Sample" from_port="example set output" to_op="Append" to_port="example set 1"/>
         <connect from_op="Filter Examples (2)" from_port="example set output" to_op="Append" to_port="example set 2"/>
         <connect from_op="Append" from_port="merged set" to_op="Naive Bayes" to_port="training set"/>
         <connect from_op="Naive Bayes" 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="629" width="431">
         <operator activated="true" class="apply_model" compatibility="5.2.008" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
           <list key="application_parameters"/>
         </operator>
         <operator activated="true" class="performance_binominal_classification" compatibility="5.2.008" expanded="true" height="76" name="Performance" width="90" x="246" y="30">
           <parameter key="accuracy" value="false"/>
           <parameter key="AUC" value="true"/>
           <parameter key="f_measure" value="true"/>
           <parameter key="false_positive" value="true"/>
           <parameter key="false_negative" value="true"/>
           <parameter key="true_positive" value="true"/>
           <parameter key="true_negative" value="true"/>
         </operator>
         <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"/>
         <portSpacing port="sink_averagable 3" spacing="0"/>
       </process>
     </operator>
     <connect from_op="Read CSV" from_port="output" to_op="Select Attributes" to_port="example set input"/>
     <connect from_op="Select Attributes" from_port="example set output" to_op="Date to Numerical" to_port="example set input"/>
     <connect from_op="Date to Numerical" 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="Nominal_Gini_top18" to_port="example set input"/>
     <connect from_op="Nominal_Gini_top18" from_port="example set output" to_op="Validation" to_port="training"/>
     <connect from_op="Validation" from_port="averagable 1" 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>

Answers

  • SkirzynskiSkirzynski Member Posts: 164 Maven
    Instead of the X-Validation you can use the X-Prediction operator which returns an example set of all examples with their predictions in the cross validation. In addition apply the "Filter Examples" operator with the condition class "wrong_predictions" to get all examples which were missclassified.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
        <process expanded="true" height="520" width="681">
          <operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve Iris" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="x_prediction" compatibility="5.3.000" expanded="true" height="60" name="X-Prediction" width="90" x="179" y="30">
            <process expanded="true" height="538" width="357">
              <operator activated="true" class="naive_bayes" compatibility="5.3.000" expanded="true" height="76" name="Naive Bayes (2)" width="90" x="112" y="30"/>
              <connect from_port="training" to_op="Naive Bayes (2)" to_port="training set"/>
              <connect from_op="Naive Bayes (2)" 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="538" width="357">
              <operator activated="true" class="apply_model" compatibility="5.3.000" expanded="true" height="76" name="Apply Model (2)" width="90" x="112" y="30">
                <list key="application_parameters"/>
              </operator>
              <connect from_port="model" to_op="Apply Model (2)" to_port="model"/>
              <connect from_port="unlabelled data" to_op="Apply Model (2)" to_port="unlabelled data"/>
              <connect from_op="Apply Model (2)" from_port="labelled data" to_port="labelled data"/>
              <portSpacing port="source_model" spacing="0"/>
              <portSpacing port="source_unlabelled data" spacing="0"/>
              <portSpacing port="source_through 1" spacing="0"/>
              <portSpacing port="sink_labelled data" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="5.3.000" expanded="true" height="76" name="Filter Examples (3)" width="90" x="313" y="30">
            <parameter key="condition_class" value="wrong_predictions"/>
          </operator>
          <connect from_op="Retrieve Iris" from_port="output" to_op="X-Prediction" to_port="example set"/>
          <connect from_op="X-Prediction" from_port="labelled data" to_op="Filter Examples (3)" to_port="example set input"/>
          <connect from_op="Filter Examples (3)" 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>

  • aryan_hosseinzaaryan_hosseinza Member Posts: 74 Contributor II
    Thanks Marcin , It's working now

Sign In or Register to comment.