Offline mode: no cluster

judy does not need Elasticsearch to measure a search. In offline mode a target is a run file. A run file holds the ranked results of an earlier system, in the TREC format that trec_eval and ranx use. judy scores it against your judgements as it scores a live search. You can try every command, wire judy into CI, or score a system judy cannot call. You need only the binary.

A judgement set says which results are good for which query. A target is whatever answers the queries; here it is a run file. Make a folder and write four files:

Shell
cat > fruit.judgements.yaml <<'EOF'
name: fruit
k: 5
gates:
  candidate: {ndcg@5: 0.9}
queries:
  - {id: q1, q: yellow fruit, ratings: {/banana: 3, /lemon: 2, /apple: 0}}
  - {id: q2, q: red fruit,    ratings: {/apple: 3, /cherry: 3, /banana: 0}}
  - {id: q3, q: citrus,       ratings: {/lemon: 3, /orange: 3}}
EOF
cat > baseline.run <<'EOF'
q1 Q0 /apple 1 9 base
q1 Q0 /lemon 2 8 base
q1 Q0 /banana 3 7 base
q2 Q0 /banana 1 9 base
q2 Q0 /apple 2 8 base
q2 Q0 /cherry 3 7 base
q3 Q0 /lemon 1 9 base
q3 Q0 /apple 2 8 base
EOF
cat > candidate.run <<'EOF'
q1 Q0 /banana 1 9 cand
q1 Q0 /lemon 2 8 cand
q2 Q0 /apple 1 9 cand
q2 Q0 /cherry 2 8 cand
q3 Q0 /lemon 1 9 cand
q3 Q0 /orange 2 8 cand
EOF
cat > judy.yaml <<'EOF'
targets:
  baseline:  {run: {file: baseline.run}}
  candidate: {run: {file: candidate.run}}
EOF

Grades run from 0 (irrelevant) to 3 (perfect). judy matches the query ids in a run file (q1) to the ids in the set. If you leave the ids out, judy keys the queries by their text, and nothing matches. Score the baseline:

Text
$ judy run fruit.judgements.yaml --target baseline
ran 3 queries against baseline in 0.0s
set fruit  target baseline  labels human
queries 3 (3 scorable)

all
  success@1  0.333
  success@3  1.000
  mrr@5      0.667
  ndcg@5     0.638
  recall@5   0.833
  err@5      0.573
  judged@5   0.467
…
wrote fruit.baseline.results.yaml

Then the candidate. The set holds a gate for it (ndcg@5 of at least 0.9):

Text
$ judy run fruit.judgements.yaml --target candidate
…
gates
  ok   ndcg@5 1.000 >= 0.900

When a gate fails, judy says which one and exits with code 1:

Text
gates
  FAIL ndcg@5 0.638 < 0.800
  FAIL success@1 0.333 < 0.500

Compare the two results files:

Text
$ judy compare fruit.baseline.results.yaml fruit.candidate.results.yaml
ndcg@5: baseline -> candidate over 3 paired queries
  mean 0.638 -> 1.000  (+0.362)
  3 better, 0 same, 0 worse   p = 0.25 (not distinguishable from noise)

most improved
   +0.394  0.606 -> 1.000  yellow fruit
   +0.387  0.613 -> 1.000  citrus
   +0.307  0.693 -> 1.000  red fruit

All three queries improved, and judy still says three queries cannot prove it. That is the point of the paired test.

Point judy at a live index, or read how judgement sets and targets work. For a CI job that scores a saved run file, see In CI.