1

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;
2
  • Actually, you can get both the forms from the OpenCV implementation since it uses LibSVM.. Read the paper I linked for more information.
    – scap3y
    Dec 18, 2013 at 16:04
  • I know, but in the case of OpenCV, it is primal?
    – Han
    Dec 18, 2013 at 16:26

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.