Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #start calculation for task1 iff y=1, otherwise use given prototypes
- #zeros(1) is a dummy default, overwrite it!!!
- #use y=0 if you want to do classification for task3
- def process_calculation(y=1,iter = 3, protos = zeros(1)):
- for i in range(iter):
- for k in ks:
- if y:
- protos = kmeans(train_images,k)
- plabels = prototype_labels(protos,train_images,train_labels)
- picture_protos(protos,i,k)
- err,n = errorrate(test_images,test_labels,protos,plabels)
- print 'Errorate with k=' + str(k) + ':\t' + str(err/float(n))
Add Comment
Please, Sign In to add comment