# Leakage-safe evaluation VariantHound reports three different questions separately. Their results must never be pooled into one headline metric. ## Mode 1 — clinical retrieval All evidence available in the selected release may be used. This measures whether established veterinary knowledge can be retrieved. It is useful to users, but it is not evidence of novel-gene discovery performance. ## Mode 2 — discovery simulation The benchmark case declares the exact canine evidence and disease identifiers that must be removed before ranking. Masking occurs before source scoring, so the target edge cannot contribute indirectly through evidence fusion. The ETL must also collapse duplicate source rows and trace derived edges back to their originating records. Required audit checks: - no target canine disease-gene or disease-variant edge remains; - no duplicate or synonym edge recreates the target association; - the target publication is not converted into another feature; - all removed record identifiers are written to the evaluation manifest. ## Mode 3 — temporal validation The knowledge layer is materialized from releases and records available no later than a declared cutoff. Test discoveries must be later than that cutoff. Undated evidence is excluded. The ranker fails if the dataset does not declare a compatible historical cutoff. A publication year on an individual row is necessary but not sufficient. Ontologies, association tables, identifier mappings, and orthology releases must also be historically pinned. Until those archives exist, a case is marked `requires-historical-snapshot` and no temporal performance claim is permitted. ## Splitting unit The independent unit is the benchmark's `disease_group_id`, not an evidence row. Multiple variants, publications, breeds, or phenotype rows describing the same discovery share that identifier and remain in the same fold. Random row splits are prohibited. ## Metrics Report top-1, top-5, and top-10 recall, mean reciprocal rank, nDCG, bootstrap confidence intervals, case count, and the number of unresolved mappings. Results are stratified by evidence availability and evaluation mode. ## Learned-model gate The deterministic semantic-similarity and weighted-fusion system remains the default. A learned ranker is considered only when the versioned [learned-ranking readiness gate](ML_READINESS.md) passes. Start with a regularized linear model. Adopt it only when improvement over the deterministic model is stable under discovery and temporal testing; otherwise keep the deterministic model. ## Running it ```bash npm run build:cases # regenerate cases from pinned OMIA + curation + crosswalk npm run evaluate -- --package dist/browser ``` The report is written to `dist/evaluation/report.json` and printed as a summary. ## What the harness does, and why **Cases come from data, not from invention.** `pipelines/build_benchmark_cases.py` emits a case only when OMIA marks the record rank-eligible, the causal gene has a **corroborated** crosswalk entry (so the answer key is an Ensembl gene the ranker can actually return), at least three phenotype terms exist, and OMIA records a characterisation year. On the pinned 2026-09 snapshots that yields **89 cases across 88 disease groups**, replacing three cases built on `VH:` placeholder identifiers that could not be replayed against the real ontology at all. **Groups, not rows.** Several OMIA records can describe one disorder, so every aggregate is grouped by `disease_group_id` and the bootstrap resamples groups. Resampling rows would treat two views of one disease as two independent pieces of evidence and produce confidence intervals that are too narrow. **The dataset is rebuilt per case.** `evaluate` takes a `datasetFor(case)` function rather than one prepared dataset, so each case's canine evidence is masked *before* any profile or feature exists. Handing it a single shared dataset would quietly score Mode 2 against unmasked evidence, which is the exact failure this project exists to avoid. A test asserts the per-case call. Rebuilding per case is a masking requirement, not a cost the run has to pay in full. Masking removes canine observations; it never touches the ontology, the orthology snapshot, or any human or mouse profile. So `toRankDataset` derives everything mask-invariant once per shard package and takes the canine decision fresh on every call, and the ranker reuses one ontology index across datasets built from the same terms and closure. Tests assert both: that two builds from one package share the term array but not the masking, and that giving the same terms a different closure — which is exactly what the `no-closure` ablation does — builds a separate index rather than borrowing the bridged one. A full run is eight passes (four ablations x two modes) over every case, and it prints a per-case progress line. If it appears to hang with no progress line, that is a bug, not a long computation. **A missing gene is a miss.** If the expected gene is not a candidate at all, the case counts as zero at every k rather than being dropped. Dropping it would flatter every number. **Modes are never pooled.** The harness reports Mode 1 and Mode 2 separately and refuses to combine them. ## The circularity you must not ignore 81 of the 89 cases take their phenotypes from the curation, which was derived from OMIA clinical text — the same text that produced the canine profile for the expected gene. **In Mode 1 those cases ask the system to match a string to itself.** The report marks them `circular` and says so in its notes. Mode 2 masks the canine evidence for the case's own disease, so a correct answer has to come from the human and mouse orthologs, whose annotations are independent of OMIA. **Only Mode 2 is a discovery measurement.** A Mode 1 number from this case set is not a result worth reporting. ## Ablations Each mode is also run with one evidence source removed: | Ablation | Question it answers | |---|---| | `human-only` | how much of the signal is human disease annotation? | | `mouse-only` | how much is mouse knockout phenotype? | | `no-closure` | how much depends on the UPHENO bridge? Without it HP and MP are disjoint and cross-species similarity is structurally zero. | The `no-closure` ablation is the one to watch. If Mode 2 performance barely moves when the closure is removed, cross-species transfer is not doing the work the design claims it is. On build `291112557587bf90` it moves: MRR 0.096 with the closure against 0.050 without. ## Masking policy Mode 2 is reported under two policies and they are never collapsed. | Policy | What it withholds | What it asks | |---|---|---| | `no-canine` | every direct canine observation, from every candidate | can human and mouse orthologs find this gene at all | | `own-disease` | only the canine records for the case's own disorder | this disease is new, the rest of OMIA is known | `no-canine` is the headline. `own-disease` sounds like the more realistic simulation, and it is a fair question, but it makes the expected gene the one candidate guaranteed to have no canine evidence while every competitor keeps theirs — so any scoring rule that values canine evidence penalises the right answer by construction. That is not a hypothetical: it cost a factor of five in top-5 before it was found. See `docs/EVALUATION-FINDINGS.md`. ## Scoring choices are measured, not assumed `npm run sweep` re-runs the benchmark across fusion parameters, and `npm run sweep -- --what measures` across similarity measures. Both defaults in `packages/ranker/src/fusion.ts` and `semantic.ts` were set from those curves and carry the numbers in their comments. Re-run the sweeps after any change to the evidence mix; the optima move with it.