function err = kneighest(x, y, k)
%kneighest	K Neighbor
%	yt = kneighbor(xt, x, y);
%
%	x: centers (2 * N)
%	y: corresponding output (1 * N)

%	Ling Li, Caltech
%	11/11/2000

N = size(x, 2);

err = 0;
for i = 1:N
	trainset = [1:i-1, i+1:N];
	yt = kneighbor(x(:, i), x(:, trainset), y(:, trainset), k);
	if yt ~= y(i)
		err = err + 1;
	end
end
err = err / N;
