Vizualizing SVM

kasper2304kasper2304 Member Posts: 28 Contributor II
edited November 2018 in Help
Hej guys.

I would like to visualize my support vector results in a scatterplot. I did already check the instruction given in the samples, but the problem is that when I use LIBSVM I am not given any function values. Maybe anyone can suggest how to visualize else wise. I tried plotting counter against alpha values but I am not really sure it makes sense even though it seems nice...?

If anybody out there have a suggestion to make a nice visual representation of SVM results it would be appreciated.

Good weekend.


  • Options
    SkirzynskiSkirzynski Member Posts: 164 Maven

    I have problems to plot the attributes as well and cannot see the reason directly. I have created an internal ticket for that. We will come back to this thread, if it is solved. Meanwhile you can use a very dirty hack to plot the support vectors, as you can see in the attached process. I have written the model as an XML file and load the support vectors from this XML into an ExampleSet which can be plotted easily.

    Use the XML-import wizard to adapt the configuration of the reader to your own model file.


    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.006">
     <operator activated="true" class="process" compatibility="5.3.006" expanded="true" name="Process">
       <process expanded="true">
         <operator activated="true" class="generate_data" compatibility="5.3.006" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
           <parameter key="target_function" value="two gaussians classification"/>
           <parameter key="number_of_attributes" value="2"/>
         <operator activated="true" class="read_xml" compatibility="5.3.006" expanded="true" height="60" name="Read XML" width="90" x="45" y="165">
           <parameter key="file" value="/home/marcin/svn_model.xml"/>
           <parameter key="xpath_for_examples" value="//object-stream/com.rapidminer.operator.learner.functions.kernel.LibSVMModel/com.rapidminer.operator.learner.functions.kernel.LibSVMModel/default/model/SV/libsvm.svm__node-array"/>
           <enumeration key="xpaths_for_attributes">
             <parameter key="xpath_for_attribute" value="libsvm.svm__node[1]/value[1]/text()"/>
             <parameter key="xpath_for_attribute" value="libsvm.svm__node[2]/value[1]/text()"/>
           <list key="namespaces"/>
           <parameter key="use_default_namespace" value="false"/>
           <list key="annotations"/>
           <list key="data_set_meta_data_information">
             <parameter key="0" value="att1.true.real.attribute"/>
             <parameter key="1" value="att2.true.real.attribute"/>
         <operator activated="true" class="support_vector_machine_libsvm" compatibility="5.3.006" expanded="true" height="76" name="SVM" width="90" x="246" y="30">
           <list key="class_weights"/>
         <operator activated="true" class="write_model" compatibility="5.3.006" expanded="true" height="60" name="Write Model" width="90" x="447" y="30">
           <parameter key="model_file" value="/home/marcin/svn_model.xml"/>
           <parameter key="output_type" value="XML"/>
         <connect from_op="Generate Data" from_port="output" to_op="SVM" to_port="training set"/>
         <connect from_op="Read XML" from_port="output" to_port="result 2"/>
         <connect from_op="SVM" from_port="model" to_op="Write Model" to_port="input"/>
         <connect from_op="Write Model" from_port="through" 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"/>
         <portSpacing port="sink_result 3" spacing="0"/>
  • Options
    kasper2304kasper2304 Member Posts: 28 Contributor II
    Thanks alot for the help!

    Goow weekend:)
Sign In or Register to comment.