hit@k, recall@k, precision@k, MRR and nDCG@k in plain Java with their edge cases pinned by tests, a 30-question graded golden dataset over a 40-passage runbook, a paired bootstrap, and a gate (baseline + tolerance + no new misses) shown failing on a tokenizer that drops digits. BM25, a hashed-trigram vector (not a neural embedding) and RRF; no model, no network. Java 25, JUnit 6.1.3. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7F47n8shUHpexxavn
19 lines
643 B
Java
19 lines
643 B
Java
package com.ankurm.rageval;
|
|
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* One row of the golden dataset: a question, the passages that answer it, and how well each one does.
|
|
*
|
|
* <p>{@code grades} maps passage id to a relevance grade: 2 = answers the question on its own,
|
|
* 1 = useful supporting context. Passages not listed are grade 0. Binary metrics (hit, recall,
|
|
* precision, MRR) treat every listed passage as relevant; nDCG uses the grades.
|
|
*/
|
|
public record GoldenQuestion(String id, String category, String query, Map<String, Integer> grades) {
|
|
|
|
public Set<String> relevantIds() {
|
|
return grades.keySet();
|
|
}
|
|
}
|