nx_ir_eval.nx
buildroot/runtime/nx_ir_eval.nx
about
nx_ir_eval.nx -- sovereign IR evaluation metrics: THE RULER for search SOTA.
module: nishi-core.search.ir_eval
depends: fx.nx, syscalls.nx
capability: CORE_COMPUTE
wired_status: LIBRARY
genealogy_id: jarvelin_kekalainen_2002_ndcg ; voorhees_trec_mrr ; trec_map
WHY: "state of the art" is a MEASURED claim, never an asserted one. Before any
fusion/rerank rung may claim a lift it must move a number on a FIXED ruler.
This organ is that ruler -- nDCG@k, MRR, Recall@k, Precision@k, and Average
Precision -- computed bit-exact in Q16.16 (fx.nx) so a score is reproducible on
every target and a faked improvement cannot hide. The rank discount is
1/log2(rank+1) via fx_log2_int (Jarvelin & Kekalainen 2002), the exact use
fx.nx's fixed-point log2 was built for.
Conventions:
gains[i] = graded relevance of the doc at 0-based rank i (>= 0).
rels[i] = 1 if the doc at rank i is relevant, else 0.
n = number of ranked results; k = cutoff.
All ratio outputs are Q16.16 in [0, FX_ONE(=65536)]; 0 means undefined/empty.
dependencies 2 imports · 5 importers
imports: fx.nxsyscalls.nx
imported by: nx_ir_eval_gate.nxnx_recall_bench.nxnx_recall_eval.nxnx_recall_fuse_gate.nxnx_recall_rerank_gate.nx
structs
| none |
consts
| none |
functions
| 31 | func ie_dcg_at_k(gains: *i64, n: i64, k: i64) -> i64 |
| 49 | func ie_sort_desc(src: *i64, n: i64, dst: *i64) -> i64 called by 1: ie_ndcg_at_k |
| 72 | func ie_ndcg_at_k(gains: *i64, n: i64, k: i64) -> i64 |
| 86 | func ie_mrr(rels: *i64, n: i64) -> i64 |
| 98 | func ie_hits_at_k(rels: *i64, n: i64, k: i64) -> i64 |
| 111 | func ie_recall_at_k(rels: *i64, n: i64, k: i64, total_relevant: i64) -> i64 |
| 117 | func ie_precision_at_k(rels: *i64, n: i64, k: i64) -> i64 |
| 126 | func ie_ap(rels: *i64, n: i64, total_relevant: i64) -> i64 |