June 2016
Beginner to intermediate
304 pages
6h 24m
English
It would be nice to know the confidence with which we classify unknown data. When a new datapoint is classified into a known category, we can train the SVM to compute the confidence level of this output as well.
svm_confidence.py file already provided to you. We will only discuss the core of the recipe here. Let's define some input data:# Measure distance from the boundary input_datapoints = np.array([[2, 1.5], [8, 9], [4.8, 5.2], [4, 4], [2.5, 7], [7.6, 2], [5.4, 5.9]])
print "\nDistance from the boundary:"
for i in input_datapoints:
print i, '-->', classifier.decision_function(i)[0]