Metrics
hit_n(rs, n=1)
Calculate Hit@N. Args: rs (list of lists): List of results for each query. Each result is a list of binary values (1 if the item is relevant, 0 otherwise). n (int): The maximum rank to consider a hit.
Source code in TimelineKGQA/rag/metrics.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
mean_reciprocal_rank(rs)
Calculate Mean Reciprocal Rank (MRR).
rs (list of lists): List of results for each query. Each result is a list of binary values (1 if the item is relevant, 0 otherwise).
Returns: float: Mean Reciprocal Rank (MRR) score.
Source code in TimelineKGQA/rag/metrics.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|