Beispiel #1
0
print "Trained:"
print "--------"

# learn w
maxEpoches=1000 # increase this value and you get better results. But you have to wait 3 days for it ...
w=perco.perco(transformedAll,yAll,maxEpoches)
print 'w= ', np.ndarray.tolist(w)


# test how good our classifier works ...
okCtr=0
nokCtr=0
for i in range(0,2*numPoints):
	x=np.reshape(transformedAll[i,:],[np.size(transformedAll,1),1])
	classified=perco.classify(x,w)
	if yAll[i] == classified:
		okCtr=okCtr+1
	else:
		nokCtr=nokCtr+1

# plot statictis ...
print ''
print 'Correct classified: ', int((okCtr+0.0)/(2*numPoints)*100), '%'
print 'Wrong classified: ', int((nokCtr+0.0)/(2*numPoints)*100), '%'

print "Analytical:"
print "-----------"

# w0 = x0^2 + y0^2 - r^2
# w1 = -2*x0