We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d67f2cb commit af44870Copy full SHA for af44870
1 file changed
tests/test_metrics.py
@@ -2,7 +2,7 @@
2
import pytest
3
4
from semsearcheval.data import Result
5
-from semsearcheval.metrics import Accuracy, Latency, NDCG
+from semsearcheval.metrics import NDCG, Accuracy, Latency
6
7
8
@pytest.mark.parametrize(
@@ -29,8 +29,12 @@ def test_accuracy_at_k(similarity, gold_indices, k, expected):
29
# Gold doc at rank 2 for query 0, not in top 1 for query 1
30
# Query 0: gold=0, scores=[0,1,0] -> ranked [1,0,2] -> gold at rank 2 -> 1/log2(3)
31
# Query 1: gold=1, scores=[0,0,1] -> ranked [2,0,1] -> gold at rank 3 -> 1/log2(4)
32
- (np.array([[0, 1, 0], [0, 0, 1]]), np.array([0, 1]), 10,
33
- (1.0 / np.log2(3) + 1.0 / np.log2(4)) / 2 * 100),
+ (
+ np.array([[0, 1, 0], [0, 0, 1]]),
34
+ np.array([0, 1]),
35
+ 10,
36
+ (1.0 / np.log2(3) + 1.0 / np.log2(4)) / 2 * 100,
37
+ ),
38
# Gold doc outside top 1 for both -> 0%
39
(np.array([[0, 1, 0], [0, 0, 1]]), np.array([0, 1]), 1, 0.0),
40
],
0 commit comments