Skip to content

Commit cf3ad78

Browse files
authored
Fix bert score (#30)
fix sim calculation
1 parent 34a7914 commit cf3ad78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ragas/metrics/similarity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def score(
5050
)
5151

5252
if self.similarity_metric == "cosine":
53-
score = np.dot(gndtruth_emb, gentext_emb.T) / (
54-
norm(gndtruth_emb) * norm(gentext_emb)
53+
score = np.sum(gndtruth_emb * gentext_emb, axis=1) / (
54+
norm(gndtruth_emb, axis=1) * norm(gentext_emb, axis=1)
5555
)
5656

5757
elif self.similarity_metric == "euclidean":

0 commit comments

Comments
 (0)