Hi guys,
Is it possible to get the decision function value from your implementation of libSVM?
There is a field called 'function value' in the support vector table of the model but in the case I show below, it is all zero. Maybe this is not it though as we'd expect the function to be defined for all cases, not just the support vectors.
The decision function is:
f(x)= sgn(sum_over_all_i {a*yk(x_i,x) } ) where a* is the optimized Lagrangian multipliers, y is the observed target value and k() is the kernel).
Thanks!
Data and Code are below:
I used a small data set:
x1 x2 class
0 0.7 One
0.7 0 One
0 -0.7 One
-0.7 0 One
0.5 0.5 One
-0.5 0.5 One
-0.5 -0.5 One
0.5 -0.5 One
0 2.8 Two
-2.8 0 Two
0 -2.8 Two
2.8 0 Two
2 2 Two
-2 2 Two
-2 -2 Two
2 -2 Two
Here is the code I ran:
<?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="341" width="547">
<operator activated="true" class="retrieve" expanded="true" height="60" name="Retrieve" width="90" x="45" y="75">
<parameter key="repository_entry" value="//Default/svmTest"/>
</operator>
<operator activated="true" class="nominal_to_binominal" expanded="true" height="94" name="Nominal to Binominal" width="90" x="246" y="30">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="class"/>
<parameter key="include_special_attributes" value="true"/>
</operator>
<operator activated="true" class="support_vector_machine_libsvm" expanded="true" height="76" name="SVM (2)" width="90" x="45" y="210">
<parameter key="kernel_type" value="poly"/>
<parameter key="degree" value="2"/>
<parameter key="gamma" value="1.0"/>
<parameter key="C" value="10.0"/>
<list key="class_weights"/>
<parameter key="confidence_for_multiclass" value="false"/>
</operator>
<operator activated="true" class="apply_model" expanded="true" height="76" name="Apply Model" width="90" x="246" y="255">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance_classification" expanded="true" height="76" name="Performance" width="90" x="380" y="165">
<list key="class_weights"/>
</operator>
<connect from_op="Retrieve" from_port="output" to_op="Nominal to Binominal" to_port="example set input"/>
<connect from_op="Nominal to Binominal" from_port="example set output" to_op="SVM (2)" to_port="training set"/>
<connect from_op="SVM (2)" from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_op="SVM (2)" from_port="exampleSet" 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="Apply Model" from_port="model" to_port="result 1"/>
<connect from_op="Performance" from_port="performance" to_port="result 2"/>
<connect from_op="Performance" from_port="example set" 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>