def kendall_tau(y_true, y_pred):
"""
Calculate Kendall's tau between ``y_true`` and ``y_pred``.
:param y_true: The true/actual/gold labels for the data.
:type y_true: array-like of float
:param y_pred: The predicted/observed labels for the data.
:type y_pred: array-like of float
:returns: Kendall's tau if well-defined, else 0
"""
ret_score = kendalltau(y_true, y_pred)[0]
return ret_score if not np.isnan(ret_score) else 0.0
评论列表
文章目录