#NEWLINE# def print_incorrect( clf , X , Y ) : #NEWLINE# #INDENT# Y_hat = clf . predict ( X ) #NEWLINE# wrong_idx = ( Y_hat != Y ) #NEWLINE# X_wrong = X [ wrong_idx ] #NEWLINE# Y_wrong = Y [ wrong_idx ] #NEWLINE# Y_hat_wrong = Y_hat [ wrong_idx ] #NEWLINE# for idx in range ( len ( X_wrong ) ) : #NEWLINE# #INDENT# print ( ( "clf.predict('%s')=%i instead of %i" % ( X_wrong [ idx ] , Y_hat_wrong [ idx ] , Y_wrong [ Y_wrong ] ) ) )