Unformatted text preview: test_diff_z = complex(test_diff(1,:),test_diff(2,:)); [training_sort,ind]=sort(abs(test_diff_z)); % Find the distance between the testing samples and training samples testNN(t) = double(ind(1) > 50); % assign 1 to the sample if the NN belongs to Class 2 (index > 50) test3NN(t) = (sum(double(ind(1:3) > 50)) > 1); % assign 1 to the sample if STRICTLY MORE than ONE of 3 NNs belong to Class 2 end P_E_NN = (sum(testNN(1:100))/100 + (1  sum(testNN(101:200))/100))/2 % calculate the probability of error for NN rule P_E_3NN = (sum(test3NN(1:100))/100 + (1  sum(test3NN(101:200))/100))/2 % calculate the probability of error for 3NN rule...
View
Full
Document
This note was uploaded on 10/26/2009 for the course CMSC 828 taught by Professor Staff during the Fall '05 term at Maryland.
 Fall '05
 staff

Click to edit the document details