0

Hello actually i'm developing a CBIR using opencv for features extraction and for the svm.

My issues is : I'm using a ONE_CLASS classifier with a RBF Kernel. I'm using the function predict of opencvSVM with the last parameter at true ( means that if the classifieur is binary then it return the signed distance to the margin ) in order to classify my data.

But even if this parameters is set to true it's return only the label ( so not very helpful in my case).

So my question is : What is the equation ( knowing the vector support) to calcul the distance of a data to the marge ?

Thanks

greeness
  • 15,956
  • 5
  • 50
  • 80
  • Hey Jonas... your question is not very clear to me. I am guessing that English is not your first language? If spanish is your first language (just guessing) I might be able to help you. – Pedrom Jul 17 '15 at 12:44
  • thank you for answer and sorry for the orthography ! My issue is i need to know how far a unknown data is from the marge in order to label this data by the user. I need this because i'm developing a CBIR and so i need the user label informative data. In my case "informative" data is the one witch is closer to the margin like this the SVM will converge step by step. – Jonas Gonzalez Jul 17 '15 at 12:49
  • Don't worry... English is not my first language either :) As for your requirement... It seems like you are looking for the geometric margin. You can check this answer to see if that is what you are looking for : http://stackoverflow.com/questions/20058036/svm-what-is-a-functional-margin – Pedrom Jul 17 '15 at 13:28
  • Thank you i understand my problem. Sorry for not seeking harder before asking ! – Jonas Gonzalez Jul 21 '15 at 11:14

1 Answers1

0

In general, distance from the separating hyperplane is the exact same thing SVM is using for classification. In other words classification equation is simply a sign of the signed distance you are asking for.

Given your kernel K, support vectors SV_i, and alpha coefficients alpha_i (Lagrange multipliers) and threshold (bias) b the equation is simply, given labels associated with each support vector y_i:

sgn_dist(x) = SUM_i alpha_i y_i K(x, SV_i) - b

This is signed distance, so you get positive value when it is on positive side and negative otherwise, if you want a "true" distance (without label) simply divide by label or take absolute value

dist(x) = |sgn_dist(x)| = |SUM_i alpha_i y_i K(x, SV_i) - b|
lejlot
  • 64,777
  • 8
  • 131
  • 164
  • Thanks **lejlot** i will seek for this but in opencvSVM i can't have all the parameters your explain in order to calcul the "true" distance.If i have to re-calculate the lagrange multipliers it will be useless to use the opencv no ? Because the reason why i'm asking for this is that in my CBIR i use Active-Learning and one of the "best" method with SVM is to query the data that lay close to the marge. I can't use the support vector because the goal is to query and unknown data. I solve a part of my problem using a NU_CLASSIFIER and now the predict function return the "true" distance – Jonas Gonzalez Jul 17 '15 at 12:48