def score_sentence_level(gold, pred): pearson = pearsonr(gold, pred) mae = mean_absolute_error(gold, pred) rmse = np.sqrt(mean_squared_error(gold, pred)) spearman = spearmanr(rankdata(gold, method="ordinal"), rankdata(pred, method="ordinal")) delta_avg = delta_average(gold, rankdata(pred, method="ordinal")) return (pearson[0], mae, rmse), (spearman[0], delta_avg)
def sentence_level_scores( true_targets: List[float], predicted_targets: List[float]) -> Tuple[Tuple, Tuple]: pearson = pearsonr(true_targets, predicted_targets) mae = mean_absolute_error(true_targets, predicted_targets) rmse = np.sqrt(mean_squared_error(true_targets, predicted_targets)) spearman = spearmanr( rankdata(true_targets, method="ordinal"), # NOQA rankdata(predicted_targets, method="ordinal"), # NOQA ) delta_avg = delta_average(true_targets, rankdata(predicted_targets, method="ordinal")) return (pearson[0], mae, rmse), (spearman[0], delta_avg)