Reputation: 77
In the primal form. few values of alpha in svm are positive and the corresponding x will be the support vectors as shown http://en.wikipedia.org/wiki/Support_vector_machine.
Correct if i am wrong, SVM in OpenCV is in Primal form? Then the question is why opencv takes the absolute value of alpha and also it is multiplied by y?and the checks if greater than 0?
This can be seen:
for( i = 0; i < sample_count; i++ )
alpha[i] *= y[i];
What i meant can be seen as it counts the support vectors if the absolute is larger than 0
for( i = 0; i < sample_count; i++ )
sv_count += fabs(alpha[i]) > 0;
Upvotes: 1
Views: 280
Reputation: 6544
The OpenCV form is in the dual. The primal does not have the alphas. They simply rolled the sign of the label into the sign of the alphas since the alphas must be positive - saves on space and ups.
Upvotes: 2