From c2c9d5bb89314c671d7484672ed3ec498152708b Mon Sep 17 00:00:00 2001 From: GitMarco27 <72693100+GitMarco27@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:52:44 +0100 Subject: [PATCH] Bug fixing recall in _factual_correctness.py (#1650) Bug fixing recall in factual correctness: recall is equal to: tp / (tp + fn) but was calculated exactly like the precision. Reference: https://docs.ragas.io/en/latest/concepts/metrics/available_metrics/factual_correctness/#factual-correctness --- src/ragas/metrics/_factual_correctness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ragas/metrics/_factual_correctness.py b/src/ragas/metrics/_factual_correctness.py index 1b42b4713..582ab3c0e 100644 --- a/src/ragas/metrics/_factual_correctness.py +++ b/src/ragas/metrics/_factual_correctness.py @@ -300,7 +300,7 @@ async def _single_turn_ascore( if self.mode == "precision": score = tp / (tp + fp + 1e-8) elif self.mode == "recall": - score = tp / (tp + fp + 1e-8) + score = tp / (tp + fn + 1e-8) else: score = fbeta_score(tp, fp, fn, self.beta)