#NEWLINE# def pearson( y_true , y_pred ) : #NEWLINE# #INDENT# '\n    Calculate Pearson product-moment correlation coefficient between ``y_true``\n    and ``y_pred``.\n\n    :param y_true: The true/actual/gold labels for the data.\n    :type y_true: array-like of float\n    :param y_pred: The predicted/observed labels for the data.\n    :type y_pred: array-like of float\n\n    :returns: Pearson product-moment correlation coefficient if well-defined,\n              else 0\n    ' #NEWLINE# ret_score = pearsonr ( y_true , y_pred ) [ 0 ] #NEWLINE# return ( ret_score if ( not np . isnan ( ret_score ) ) else 0.0 )