March 2020
Intermediate to advanced
366 pages
9h 8m
English
There are many ways to evaluate a classifier, but most often, we are simply interested in the accuracy metric—that is, how many data samples from the test set were classified correctly.
In order to arrive at this metric, we need to get the prediction results out of the SVM—and again, OpenCV has us covered, by providing the predict method that takes a matrix of features and returns an array of predicted labels. We thus need to proceed as follows:
x_train = featurize(train_data)
y_predict = model.predict(x_test)