the last few lines select the best model first we compare the predictionspredwith the actual labelsvirginica the little trick of computing the mean of the comparisons gives us the fraction of correct resultsthe accuracy at the end of the for loopall possible thresholds for all possible features have been testedand the best_fi and best_t variables hold our model to apply it to new examplewe perform the followingif example[best_fitprint 'virginicaelseprint 'versicolorwhat does this model look likeif we run it on the whole datathe best model that we get is split on the petal length we can visualize the decision boundary in the following screenshotwe see two regionsone is white and the other is shaded in grey anything that falls in the white region will be called iris virginica and anything that falls on the shaded side will be classified as iris versicolorin threshold modelthe decision boundary will always be line that is parallel to one of the axes the plot in the preceding screenshot shows the decision boundary and the two regions where the points are classified as either white or grey it also shows (as dashed linean alternative threshold that will achieve exactly the same accuracy our method chose the first thresholdbut that was an arbitrary choice