The sign in CvSVM::predict

asked 2014-04-25 06:22:39 -0500

Ahmad Sanny gravatar image

updated 2014-04-26 00:49:47 -0500

berak gravatar image

Hi all,,

I'm using a binary SVM to classify positive and negative sets of images encoded using HOG descriptors to the machine; I labeled my positive set '1' and '0' for the negative one during training.

Based on the OpenCV manual, using float response = predict(inputMat, true); returns the signed decision function value. Does the negative sign denotes a Positive label '1'? I made few experiments* to reach this conclusion and I just want a confirmation from anyone knowledgeable/experienced with SVMs.

*The experiments was applied on 2 positives and 2 negatives using float response = predict(inputMat, true); once and then using float response = predict(inputMat); //Default false, returns label. I hope my conclusion applies to any image. Thank you :)

edit retag flag offensive close merge delete

Comments

1

I think you should -1 and 1 as labels if I am correct for your classes... the same output should be generated then for both classes.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-25 06:32:40 -0500 )edit

@StevenPuttemans Hi there, do you mean -1 for positive and 1 for negative or it doesn't matter? thanks

Ahmad Sanny gravatar imageAhmad Sanny ( 2014-04-25 10:24:21 -0500 )edit
1

In practice people take +1 for positives; but it does not really matter in fact.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-25 15:21:50 -0500 )edit

thanks @StevenPuttemans. your help is most appreciated. just pardon me for my last question, does the negative response in my experiment is due to training the positive set first then the negative set?

Ahmad Sanny gravatar imageAhmad Sanny ( 2014-04-26 02:47:40 -0500 )edit
1

You train an SVM all at once afaik, pos and negatives together with their label.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-26 09:19:38 -0500 )edit
1

thank you so much, @StevenPuttemans.

Ahmad Sanny gravatar imageAhmad Sanny ( 2014-04-28 02:45:13 -0500 )edit

You are welcome

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-28 02:49:30 -0500 )edit