diff --git a/metrics/spearmanr/spearmanr.py b/metrics/spearmanr/spearmanr.py index 3be1743e7..44d372638 100644 --- a/metrics/spearmanr/spearmanr.py +++ b/metrics/spearmanr/spearmanr.py @@ -113,12 +113,8 @@ def _info(self): ) def _compute(self, predictions, references, return_pvalue=False): + results = spearmanr(references, predictions) if return_pvalue: - return { - "spearmanr": spearmanr(references, predictions)[0], - "spearmanr_pvalue": spearmanr(references, predictions)[1], - } + return {"spearmanr": results[0], "spearmanr_pvalue": results[1]} else: - return { - "spearmanr": spearmanr(references, predictions)[0], - } + return {"spearmanr": results[0]}