def precision_score(y_real, y_pred):
 (p, _, _) = precision_recall_fscore(y_real, y_pred)
 return np.average(p)

def precision_score ( y_real , y_pred ) : ( p , _ , _ ) = precision_recall_fscore ( y_real , y_pred ) return np . average ( p )
compute the precision the precision is the ratio :math:tp / where tp is the number of true positives and fp the number of false positives .