#NEWLINE# def get_score( X , y , clf , scoring = 'accuracy' ) : #NEWLINE# #INDENT# prediction = clf . predict ( X ) #NEWLINE# if ( scoring == 'accuracy' ) : #NEWLINE# #INDENT# from sklearn.metrics import accuracy_score #NEWLINE# score = accuracy_score ( y , prediction ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( scoring == 'f1' ) : #NEWLINE# #INDENT# from sklearn.metrics import f1_score #NEWLINE# score = f1_score ( y , prediction ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# score = scoring ( y , prediction . squeeze ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( prediction , score )