def classification_rate(features):
 labels = _knn.predict(trainset[N_TRAIN:], features)
 return (sum(((x == y) for (x, y) in zip(labels, trainlabels[N_TRAIN:]))) / float(len(trainlabels[N_TRAIN:])))

def classification_rate ( features ) : labels = _knn . predict ( trainset [ N_TRAIN : ] , features ) return ( sum ( ( ( x == y ) for ( x , y ) in zip ( labels , trainlabels [ N_TRAIN : ] ) ) ) / float ( len ( trainlabels [ N_TRAIN : ] ) ) )
returns the classification rate of the default knn .