code wiki / (root) / nx_recall_eval.nx

nx_recall_eval.nx

buildroot/runtime/nx_recall_eval.nx

4415 B83 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic recall
docsdependenciesstructsconstsfunctions

about

nx_recall_eval.nx -- the recall RULER as a service (R0 on MCP/API). Parse a ranked graded-relevance vector (argv gains-csv) and emit an honest IR scorecard JSON (nDCG@k / MRR / Recall@k / P@k / AP) via nx_ir_eval. Any caller -- the compare C5 grader, a workstream, a session -- grades a ranking without re-implementing the metrics; sovereign, integer-deterministic, same number on every machine. nx_recall_eval <gains-csv> [total_relevant] [k] e.g. nx_recall_eval 3,0,1,0,0 -> {..."ndcg_permil":964,"mrr_permil":1000,...} license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 4 imports · 0 importers

fx.nx nx_itoa_lib.nx nx_ir_eval.nx syscalls.nx nx_recall_eval.nx

imports: fx.nxnx_itoa_lib.nxnx_ir_eval.nxsyscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main re_puts re_parse_csv re_key re_q re_puts ↻ re_q ↻ re_arg_int re_parse_csv ↻ ie_ndcg_at_k ie_sort_desc ie_dcg_at_k fx_log2_int fx_log2 fx_mul fx_from_int fx_div fx_from_int ↻ fx_div ↻ ie_mrr fx_from_frac ie_recall_at_k fx_from_frac ↻ ie_hits_at_k ie_precision_at_k fx_from_frac ↻ ie_hits_at_k ↻ ie_ap fx_from_frac ↻ fx_div ↻ fx_from_int ↻ re_num nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap re_permil

structs

none

consts

13const K_MAGIC_32768: i64 = 32768
14const K_MAGIC_65536: i64 = 65536

functions

16func re_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: re_keymain
17func re_q() -> i64 { let b: *u8 = sys_mmap(1); b[0] = 34 as u8; sys_write(1, b, 1); return 0 }
called by 2: re_keymain
18func re_key(name: *u8) -> i64 { re_q(); re_puts(name); re_q(); re_puts(":" as *u8); return 0 }
called by 1: main calls 2: re_qre_puts
23func re_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
25func re_permil(fxv: i64) -> i64 { return (fxv * 1000 + K_MAGIC_32768) / K_MAGIC_65536 }
called by 1: main
27func re_parse_csv(s: *u8, n: i64, out: *i64, maxn: i64) -> i64
called by 2: re_arg_intmain
41func re_arg_int(a: *u8, dflt: i64) -> i64
called by 1: main calls 1: re_parse_csv
48func main(argc: i64, argv: *i64) -> i64