This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

The output of predict will be the label which you have set the class with. For example, if you have set up a binary SVM then you will have likely also set up 2 labels (say -1 and 1). If the SVM decides that the `Mat`

in question is of class -1 then it will return -1.

The sign is dependent entirely on the labels you set, if you don't use a sign then there will be none.

All that said, If you look at the [documentation] then you'll find that there is a second parameter to the predict function:

returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).

In simple terms, if you pass true for the second parameter you don't get back your class label, but the distance from the margin, and here the sign matters as it will be the direction away from the hyperplane. But *only* if you are doing a binary classification!

I'm not sure about your last question about the probability for non-binary problems, but in the case of a binary problem then the distance is your probability, the farther from the margin the more likely the object belongs to the class on that side of the cutting plane. The negative/positive will tell you which class it is.

2 | link not appearing in final answer, so adding it in manually. |

The output of predict will be the label which you have set the class with. For example, if you have set up a binary SVM then you will have likely also set up 2 labels (say -1 and 1). If the SVM decides that the `Mat`

in question is of class -1 then it will return -1.

The sign is dependent entirely on the labels you set, if you don't use a sign then there will be none.

All that said, If you look at the [documentation] then you'll find that there is a second parameter to the predict function:

returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).

In simple terms, if you pass true for the second parameter you don't get back your class label, but the distance from the margin, and here the sign matters as it will be the direction away from the hyperplane. But *only* if you are doing a binary classification!

I'm not sure about your last question about the probability for non-binary problems, but in the case of a binary problem then the distance is your probability, the farther from the margin the more likely the object belongs to the class on that side of the cutting plane. The negative/positive will tell you which class it is.

The documentation for predict is here: http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-predict

3 | No.3 Revision |

The output of predict will be the label which you have set the class with. For example, if you have set up a binary SVM then you will have likely also set up 2 labels (say -1 and 1). If the SVM decides that the `Mat`

in question is of class -1 then it will return -1.

The sign is dependent entirely on the labels you set, if you don't use a sign then there will be none.

All that said, If you look at the [documentation] then you'll find that there is a second parameter to the predict function:

returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).

In simple terms, if you pass true for the second parameter you don't get back your class label, but the distance from the margin, and here the sign matters as it will be the direction away from the hyperplane. But *only* if you are doing a binary classification!

I'm not sure about your last question about the probability for non-binary problems, but in the case of a binary problem then the distance is your ~~probability, ~~probability (Or can be converted, see the comments below), the farther from the margin the more likely the object belongs to the class on that side of the cutting plane. The negative/positive will tell you which class it is.

The documentation for predict is here: http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-predict

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.