
1.10 The Nearest Neighbor Rule 25
S_ML(:,:,1)=S1_ML;
S_ML(:,:,2)=S2_ML;
P=[1/2 1/2];
z=bayes_classifier(m_ML,S_ML,P,X2);
To compute the classification error, type
true_labels=y2;
Bayes_ML_error=sum(true_labels
∼
=z)/length(z)
Step 3. The resulting classification errors—naive_err or and Bayes_ML_error—are 0.1320 and 0.1426,
respectively. In other words, the naive classification scheme outperforms the standard ML-based
scheme. If the experiment is repeated for the case where X
1
consists of 20 instead of 50 points, the
difference between the performance of the two classifiers is ev en more noticeable in favor of the
naive Bayes classifier.
Exercise 1.9.1
1. Classif ...