RapidMiner 9.7 is Now Available

Lots of amazing new improvements including true version control! Learn more about what's new here.

CLICK HERE TO DOWNLOAD

"No accuracy matrix in SVM"

an0xan0x Member Posts: 3 Contributor I
edited June 2019 in Help
Hi. I have a question about SVM in rapid miner. I dont know why svm couldn't create accuracy matrix as k-nn. it just shows root mean square error. what should I do?
I'm working on Text categorization and I have 3 columns. Title,Body and label. Body and title are text and label is numeric.
I used:
read database->process document->select attribute->set role(set label column as label)-> x-validation

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.000">
<context>
  <input/>
  <output/>
  <macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.000"
expanded="true" name="Process">
  <parameter key="parallelize_main_process" value="true"/>
  <process expanded="true" height="701" width="685">
    <operator activated="true" class="read_database"
compatibility="5.2.000" expanded="true" height="60" name="Read
Database" width="90" x="45" y="30">
      <parameter key="connection" value="ISNA_11News_Normalized"/>
      <parameter key="query" value="SELECT &quot;Title&quot;,
&quot;Body&quot;, &quot;Label&quot;&#10;FROM
&quot;dbo&quot;.&quot;nws_full_corpus&quot;"/>
      <parameter key="prepare_statement" value="true"/>
      <enumeration key="parameters"/>
    </operator>
    <operator activated="true"
class="text:process_document_from_data" compatibility="5.1.004"
expanded="true" height="76" name="Process Documents from Data"
width="90" x="179" y="30">
      <parameter key="prune_method" value="absolute"/>
      <parameter key="prune_below_absolute" value="2"/>
      <parameter key="prune_above_absolute" value="9999"/>
      <list key="specify_weights"/>
      <process expanded="true" height="298" width="671">
        <operator activated="true" class="text:transform_cases"
compatibility="5.1.004" expanded="true" height="60" name="Transform
Cases" width="90" x="45" y="30"/>
        <operator activated="true" class="text:tokenize"
compatibility="5.1.004" expanded="true" height="60" name="Tokenize"
width="90" x="45" y="165"/>
        <operator activated="true" class="text:filter_by_length"
compatibility="5.1.004" expanded="true" height="60" name="Filter
Tokens (by Length)" width="90" x="179" y="120">
          <parameter key="min_chars" value="2"/>
          <parameter key="max_chars" value="99999"/>
        </operator>
        <connect from_port="document" to_op="Transform Cases"
to_port="document"/>
        <connect from_op="Transform Cases" from_port="document"
to_op="Tokenize" to_port="document"/>
        <connect from_op="Tokenize" from_port="document"
to_op="Filter Tokens (by Length)" to_port="document"/>
        <connect from_op="Filter Tokens (by Length)"
from_port="document" to_port="document 1"/>
        <portSpacing port="source_document" spacing="0"/>
        <portSpacing port="sink_document 1" spacing="0"/>
        <portSpacing port="sink_document 2" spacing="0"/>
      </process>
    </operator>
    <operator activated="true" class="select_attributes"
compatibility="5.2.000" expanded="true" height="76" name="Select
Attributes" width="90" x="313" y="30">
      <parameter key="attribute_filter_type" value="no_missing_values"/>
      <parameter key="attribute" value="Label"/>
    </operator>
    <operator activated="true" class="set_role"
compatibility="5.2.000" expanded="true" height="76" name="Set Role"
width="90" x="447" y="30">
      <parameter key="name" value="Label"/>
      <parameter key="target_role" value="label"/>
      <list key="set_additional_roles"/>
    </operator>
    <operator activated="true" class="x_validation"
compatibility="5.2.000" expanded="true" height="112" name="Validation"
width="90" x="514" y="165">
      <parameter key="number_of_validations" value="2"/>
      <parameter key="sampling_type" value="shuffled sampling"/>
      <process expanded="true" height="332" width="346">
        <operator activated="true" class="support_vector_machine"
compatibility="5.2.000" expanded="true" height="112" name="SVM (3)"
width="90" x="179" y="120"/>
        <connect from_port="training" to_op="SVM (3)" to_port="training set"/>
        <connect from_op="SVM (3)" from_port="model" to_port="model"/>
        <connect from_op="SVM (3)" from_port="estimated performance"
to_port="through 1"/>
        <portSpacing port="source_training" spacing="0"/>
        <portSpacing port="sink_model" spacing="0"/>
        <portSpacing port="sink_through 1" spacing="0"/>
        <portSpacing port="sink_through 2" spacing="0"/>
      </process>
      <process expanded="true" height="298" width="310">
        <operator activated="true" class="apply_model"
compatibility="5.2.000" expanded="true" height="76" name="Apply Model"
width="90" x="45" y="30">
          <list key="application_parameters"/>
        </operator>
        <operator activated="true" class="performance"
compatibility="5.2.000" expanded="true" height="76" name="Performance"
width="90" x="179" 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="source_through 2" spacing="0"/>
        <portSpacing port="sink_averagable 1" spacing="0"/>
        <portSpacing port="sink_averagable 2" spacing="0"/>
      </process>
    </operator>
    <connect from_op="Read Database" from_port="output"
to_op="Process Documents from Data" to_port="example set"/>
    <connect from_op="Process Documents from Data"
from_port="example set" to_op="Select Attributes" to_port="example set
input"/>
    <connect from_op="Select Attributes" 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="Validation" to_port="training"/>
    <connect from_op="Validation" from_port="model" to_port="result 1"/>
    <connect from_op="Validation" from_port="training" to_port="result 2"/>
    <connect from_op="Validation" from_port="averagable 1"
to_port="result 3"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    <portSpacing port="sink_result 3" spacing="0"/>
    <portSpacing port="sink_result 4" spacing="0"/>
  </process>
</operator>
</process>
Tagged:

Answers

  • haddockhaddock Member Posts: 849  Guru
    Hi there,

    I see you are using the automatic performance chooser, and it seems not to please ! All is not lost however, you can pick exactly what you want using the 'Performance ( Classification )' operator. Hope that does the trick.

    Good weekend!
  • an0xan0x Member Posts: 3 Contributor I
    thank you for your solution.
    I want to try it, but performance (classification) doesn't work with integer label. RM offered use discretize, i did. but it says now label and prediction must be of the same , but are nominal and integer.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="5.2.000" expanded="true" name="Process">
    <parameter key="parallelize_main_process" value="true"/>
    <process expanded="true" height="701" width="685">
    <operator activated="true" class="read_database" compatibility="5.2.000" expanded="true" height="60" name="Read Database" width="90" x="45" y="30">
    <parameter key="connection" value="ISNA_11News_Normalized"/>
    <parameter key="query" value="SELECT &quot;Title&quot;, &quot;Body&quot;, &quot;Label&quot;&#10;FROM &quot;dbo&quot;.&quot;nws_full_corpus&quot;"/>
    <parameter key="prepare_statement" value="true"/>
    <enumeration key="parameters"/>
    </operator>
    <operator activated="true" class="text:process_document_from_data" compatibility="5.1.004" expanded="true" height="76" name="Process Documents from Data" width="90" x="179" y="30">
    <parameter key="prune_method" value="absolute"/>
    <parameter key="prune_below_absolute" value="2"/>
    <parameter key="prune_above_absolute" value="9999"/>
    <list key="specify_weights"/>
    <process expanded="true" height="298" width="671">
    <operator activated="true" class="text:transform_cases" compatibility="5.1.004" expanded="true" height="60" name="Transform Cases" width="90" x="45" y="30"/>
    <operator activated="true" class="text:tokenize" compatibility="5.1.004" expanded="true" height="60" name="Tokenize" width="90" x="45" y="165"/>
    <operator activated="true" class="text:filter_by_length" compatibility="5.1.004" expanded="true" height="60" name="Filter Tokens (by Length)" width="90" x="179" y="120">
    <parameter key="min_chars" value="2"/>
    <parameter key="max_chars" value="99999"/>
    </operator>
    <connect from_port="document" to_op="Transform Cases" to_port="document"/>
    <connect from_op="Transform Cases" from_port="document" to_op="Tokenize" to_port="document"/>
    <connect from_op="Tokenize" from_port="document" to_op="Filter Tokens (by Length)" to_port="document"/>
    <connect from_op="Filter Tokens (by Length)" from_port="document" to_port="document 1"/>
    <portSpacing port="source_document" spacing="0"/>
    <portSpacing port="sink_document 1" spacing="0"/>
    <portSpacing port="sink_document 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="select_attributes" compatibility="5.2.000" expanded="true" height="76" name="Select Attributes" width="90" x="313" y="30">
    <parameter key="attribute_filter_type" value="no_missing_values"/>
    <parameter key="attribute" value="Label"/>
    </operator>
    <operator activated="true" class="set_role" compatibility="5.2.000" expanded="true" height="76" name="Set Role" width="90" x="447" y="30">
    <parameter key="name" value="Label"/>
    <parameter key="target_role" value="label"/>
    <list key="set_additional_roles"/>
    </operator>
    <operator activated="true" class="x_validation" compatibility="5.2.000" expanded="true" height="112" name="Validation" width="90" x="514" y="165">
    <parameter key="number_of_validations" value="2"/>
    <parameter key="sampling_type" value="shuffled sampling"/>
    <process expanded="true" height="332" width="346">
    <operator activated="true" class="support_vector_machine" compatibility="5.2.000" expanded="true" height="112" name="SVM (3)" width="90" x="179" y="120"/>
    <connect from_port="training" to_op="SVM (3)" to_port="training set"/>
    <connect from_op="SVM (3)" from_port="model" to_port="model"/>
    <connect from_op="SVM (3)" from_port="estimated performance" to_port="through 1"/>
    <portSpacing port="source_training" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    <portSpacing port="sink_through 2" spacing="0"/>
    </process>
    <process expanded="true" height="314" width="310">
    <operator activated="true" class="apply_model" compatibility="5.2.000" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
    <list key="application_parameters"/>
    </operator>
    <operator activated="false" class="performance" compatibility="5.2.000" expanded="true" height="76" name="Performance" width="90" x="179" y="210"/>
    <operator activated="true" class="discretize_by_user_specification" compatibility="5.2.000" expanded="true" height="94" name="Discretize" width="90" x="45" y="165">
    <parameter key="attribute_filter_type" value="regular_expression"/>
    <parameter key="regular_expression" value="Label"/>
    <parameter key="include_special_attributes" value="true"/>
    <list key="classes">
    <parameter key="first" value="-Infinity"/>
    <parameter key="last" value="Infinity"/>
    </list>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="5.2.000" expanded="true" height="76" name="Performance (2)" width="90" x="179" y="30">
    <parameter key="main_criterion" value="accuracy"/>
    <parameter key="classification_error" value="true"/>
    <list key="class_weights"/>
    </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="Discretize" to_port="example set input"/>
    <connect from_op="Discretize" from_port="example set output" to_op="Performance (2)" to_port="labelled data"/>
    <connect from_op="Performance (2)" 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="source_through 2" spacing="0"/>
    <portSpacing port="sink_averagable 1" spacing="0"/>
    <portSpacing port="sink_averagable 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Read Database" from_port="output" to_op="Process Documents from Data" to_port="example set"/>
    <connect from_op="Process Documents from Data" from_port="example set" to_op="Select Attributes" to_port="example set input"/>
    <connect from_op="Select Attributes" 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="Validation" to_port="training"/>
    <connect from_op="Validation" from_port="model" to_port="result 1"/>
    <connect from_op="Validation" from_port="training" to_port="result 2"/>
    <connect from_op="Validation" from_port="averagable 1" to_port="result 3"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    <portSpacing port="sink_result 3" spacing="0"/>
    <portSpacing port="sink_result 4" spacing="0"/>
    </process>
    </operator>
    </process>
  • haddockhaddock Member Posts: 849  Guru
    Hi there,

    If you are doing classification you should convert the Label attribute type to nominal. If you work your way through 'help->Rapidminer tutorial' you'll see why the discretize operator is inappropriate.

    Good luck.
  • an0xan0x Member Posts: 3 Contributor I
    I had a problem with nominal labels. I use SVM and SVM doesn't work with nominal labels! If I convert it to nominal, SVM doesn't work. if keep it numerical, performance doesn't work. It's a loop!
  • haddockhaddock Member Posts: 849  Guru
    Hi there,

    Try using Bayes, or another learner that takes nominal attributes, like this
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.000" expanded="true" name="Process">
        <parameter key="parallelize_main_process" value="true"/>
        <process expanded="true" height="701" width="685">
          <operator activated="true" class="generate_data" compatibility="5.2.000" expanded="true" height="60" name="Generate Data" width="90" x="179" y="165">
            <parameter key="target_function" value="simple non linear classification"/>
          </operator>
          <operator activated="true" class="discretize_by_user_specification" compatibility="5.2.000" expanded="true" height="94" name="Discretize" width="90" x="313" y="255">
            <parameter key="regular_expression" value="Label"/>
            <list key="classes">
              <parameter key="first" value="-Infinity"/>
              <parameter key="last" value="Infinity"/>
            </list>
          </operator>
          <operator activated="true" class="x_validation" compatibility="5.2.000" expanded="true" height="112" name="Validation" width="90" x="447" y="165">
            <parameter key="number_of_validations" value="2"/>
            <parameter key="sampling_type" value="shuffled sampling"/>
            <process expanded="true" height="332" width="346">
              <operator activated="false" class="support_vector_machine" compatibility="5.2.000" expanded="true" height="112" name="SVM (3)" width="90" x="179" y="30"/>
              <operator activated="true" class="naive_bayes" compatibility="5.2.000" expanded="true" height="76" name="Naive Bayes" width="90" x="179" y="165"/>
              <connect from_port="training" 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="314" width="310">
              <operator activated="true" class="apply_model" compatibility="5.2.000" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
                <list key="application_parameters"/>
              </operator>
              <operator activated="false" class="performance" compatibility="5.2.000" expanded="true" height="76" name="Performance" width="90" x="179" y="210"/>
              <operator activated="true" class="performance_classification" compatibility="5.2.000" expanded="true" height="76" name="Performance (2)" width="90" x="179" y="30">
                <parameter key="main_criterion" value="accuracy"/>
                <parameter key="classification_error" value="true"/>
                <list key="class_weights"/>
              </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 (2)" to_port="labelled data"/>
              <connect from_op="Performance (2)" 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_op="Generate Data" from_port="output" to_op="Discretize" to_port="example set input"/>
          <connect from_op="Discretize" from_port="example set output" to_op="Validation" to_port="training"/>
          <connect from_op="Validation" from_port="model" to_port="result 1"/>
          <connect from_op="Validation" from_port="training" to_port="result 2"/>
          <connect from_op="Validation" from_port="averagable 1" to_port="result 3"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
          <portSpacing port="sink_result 4" spacing="0"/>
        </process>
      </operator>
    </process>
Sign In or Register to comment.