how adjust SVM classifier prediction threshold in matlab
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Jeffrey Girard
am 17 Jul. 2015
Bearbeitet: Jeffrey Girard
am 17 Jul. 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 Kommentare
Sedo
am 25 Apr. 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.
Siehe auch
Kategorien
Mehr zu Classification Trees finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!