def testwine():
	wqred = dataifywine('wine/winequality-red.csv') + dataifywine('wine/winequality-white.csv')
	leftoutperc = 0.1
	leftout = int(len(wqred)*leftoutperc)
	testing = wqred[:leftout]
	training = wqred[leftout:]
	print "Training:",len(training)
	print "Testing:",len(testing)
	foo = FastKNN(10)
	foo.addEvidence(numpy.array([thing[:-1] for thing in training]), [thing[-1] for thing in training])
	knn.addEvidence(numpy.array(training))
	total = 0
	correct = 0
	for x in xrange(len(testing)):
		thing = testing[x]
		guess = foo.query(numpy.array(thing[:-1]),3)
		#realknn = knn.query(numpy.array([thing[:-1],]),3,method='mean')
		#guess = realknn[0]
		#print realknn
		#print guess, thing[-1]
		if guess == thing[-1]:
			correct += 1
		total += 1
		if total % 50 == 0:
			print total,'/',len(testing)
	print correct,"/",total,":",float(correct)/float(total)
	print "Average checks per query:", float(total)/float(foo.num_checks)
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/QSTK/qstklearn/fastknn.py/testwine/swapped operands of `/`