for d = 1:dsize(1)
	magn(d) = kernel(data(d,:), data(d,:));
end

mydata = point(:,2:23);
mysize = size(mydata);
dm = ones(mysize(1),1)*mean(mydata);
mydata = mydata - dm;

choosa = sum(M(1:choose, :));
choosb = sum(M(choose+1:2*choose, :));
thisc = choosa;
thatc = choosb;
right = 0;
wrong = 0;
maybe = 0;

for x = 1:30
%for x = 100:mysize(1)
	me = mydata(x,:);
	for d= 1:dsize(1)
		mygamma(d) = kernel(me, data(d,:))/magn(d);
	end
	A = gamma(1,:)'*gamma(1,:);
	dis = sum(sum(A.*prekern))-2*sum(gamma(1,:).*mygamma(d));
	best = dis;
	bclust = 1;
	distance(x, 1) = dis;
	for c = 2:nclust
		A = gamma(c,:)'*gamma(c,:);
		dis = sum(sum(A.*prekern))-2*sum(gamma(c,:).*mygamma(d));
		distance(x, c) = dis;
		if(dis < best)
			best = dis;
			bclust = c;
		end
	end
	if(thisc(bclust) > thatc(bclust))
		right = right+1;
	elseif(thisc(bclust) == thatc(bclust))
		maybe = maybe+1;
	else
		wrong = wrong+1;
	end
	[wrong./(right+wrong+maybe) bclust x]
end
