The sign in CvSVM::predict [closed]

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

Ahmad Sanny gravatar image

updated 2020-11-11 13:34:45 -0600

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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-11-11 13:34:57.996383

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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit
1

thank you so much, @StevenPuttemans.

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

You are welcome

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