how adjust SVM classifier prediction threshold in matlab

7 visualizaciones (últimos 30 días)
mary khaliji
mary khaliji el 16 de Jul. de 2015
Comentada: Sedo el 25 de Abr. de 2022
base on a paper I should train a SVM and the paper said 'Given the learned SVM classifier we then adjust its prediction threshold so that it achieves high precision.' Can you help me how I should do that. the author of the paper don't answer the question and I really need that.

Respuestas (1)

Jeffrey Girard
Jeffrey Girard el 17 de Jul. de 2015
Editada: Jeffrey Girard el 17 de Jul. de 2015
The output of the "predict" function of an SVM implementation will be a vector of size N, where N is the number of examples you are trying to get predictions for. The numbers in this vector correspond to each example's distance to the class-separating hyperplane. In order to dichotomize these values so that each is a binary corresponding to class membership, you need to use a prediction threshold. Any number greater than or equal to that threshold will be predicted to be part of the positive class and any number less than that threshold will be predicted to be part of the negative class. The definition of the SVM algorithm will ensure that a prediction threshold of 0 is the optimal threshold for the training data (i.e., it yields the highest classification accuracy). However, for generalizing to independent data sets, you may want to adjust the prediction threshold and see how your performance metric of choice (e.g., accuracy, precision, or recall) is affected. I suggest writing a simple function that accepts data and a prediction threshold and outputs a performance metric. You can then try different thresholds by looping over a range from the minimum to the maximum output value:
linspace(min(output),max(output),10)
  2 comentarios
mary khaliji
mary khaliji el 18 de Jul. de 2015
thank you for your response. Can you say me how I can obtain precision and recall from svmtrain() or svmclassify() functions?
Sedo
Sedo el 25 de Abr. de 2022
You've probably gotten your answer by now but, in case anyone else needs the answer, you can use the predicted label you got from the predict function and your triane dsmv model to get a confusion matrix. This can be done by inputting the actual labels and the predicted labels (gotten from the output of the predict function and your trained classifier) into the confusion amtirx function. Then you can use that confusion matrix to get your precision and recall.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by