CS 5320
Fall Semester 2012

 
Problem 11-1

 
Assigned: 13 November 2012
Due: 13 December 2012
 

Implement the following Matlab function (Algorithm 22.3 in Forsyth and Ponce):

function classes = CV_k_l_NN(k,l,examples,data)
%
%CV_k_l_NN - (k,l) nearest neighbor classifier
%On input:
%     k (int): number of nearest neighbors to find
%     l (int): number of votes needed to perform classification
%     examples (structure vextor): has two fields:
%         .num_points (int): number of points in sample set for class
%         .x (num_points by num_dim array+1) sample points (of dimension num_dim) and class
%     data (m by num_dim array) data points to be classified
%On output:
%     classes (mx1 vector): gives class of each data point (0 if not classified)
%Call:
%     c1 =  CV_k_l_NN(5,1,labeled_samples,x);
%Author:
%     Your name
%     UU
%     Fall 2012
%