Commit 3c5bc90
committed
feat(kpi): significance testing, a holdout half, and nDCG@10
The harness was being asked to resolve differences it could not. Decisions have
rested on natural-macro moves of 0.1–0.5 points, and its own README records a
change that moved the mean by +0.0 while 260 queries churned. "19 better / 7
worse" is a better signal than the mean and still not an answer.
lib/stats.js reports the same per-query deltas three ways: a seeded paired
bootstrap 95% CI, a Wilcoxon signed-rank p-value (non-parametric because the
per-query metric is discrete, bounded and mostly exactly zero — where a t-test
misbehaves), and the same test over TOPIC MEANS, because the headline is a macro
average and a claim about a macro has to be tested over topics. Paired
throughout: both rankers see the same queries, so the variance that matters is
the variance of the differences.
It also calibrates the evidence already in use. 19 better / 7 worse of 2,281 at
equal magnitudes is p = 0.019 — significant, so the churn count was worth more
than it looked. 12 better / 10 worse is p = 0.68 and means nothing.
lib/split.js cuts each set in two and both halves print by default, because
every constant in the ranker was chosen by sweeping it against these sets and a
training score that reads as a measurement is the failure this prevents. The cut
is BY TOPIC, never by query: the natural harvest expands each seed a–z, so
`imqueue rpc` and `imqueue rpc example` are near-twins on the same page, and
splitting by query would put twins on both sides and make the holdout agree with
the fit by construction. Artificial is cut by TARGET PAGE — its `bucket` is a
query SHAPE, and cutting on shape produced halves made of different populations
and read the difference as a 5.6-point fitting gap on a ranker nobody had tuned
against that set at all.
The result is good news that was not guaranteed:
natural fit 87.8% holdout 90.3% (-2.5, holdout BETTER)
artificial fit 98.5% holdout 98.5% (+0.0)
question fit 62.4% holdout 60.6% (+1.8, inside the noise of 56 queries)
No detectable overfitting after twenty rounds of hand-tuning.
nDCG@10 is reported beside the linear metric rather than replacing it. The -10
per position rule says something true — nobody scrolls to row eleven — but it
overstates #5 against #7 and understates #1 against #2; the two together say
more than either. One relevant document per query, because `expect` lists
ALTERNATIVES, and textbook DCG summing over them would reward returning three
spellings of the same answer. `grades` is honoured where a query carries one, so
a graded label set needs no further harness change.
compare.js gains the question set. It measured two of the three populations, and
the missing one is the only set that has ever caught a regression the other two
could not see.
check-search-ranking.js gains three cases for the ranker's new relaxation pass,
including the gate itself — a query that returns results must never be rewritten.
The safety argument for spelling correction is worth exactly as much as that
assertion.
Pins search-ranker 6fc2ca8.1 parent 539edb6 commit 3c5bc90
9 files changed
Lines changed: 626 additions & 20 deletions
File tree
- scripts
- search-kpi
- lib
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
744 | 802 | | |
745 | 803 | | |
746 | 804 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
24 | 35 | | |
25 | 36 | | |
26 | 37 | | |
| |||
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
91 | | - | |
92 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
93 | 105 | | |
94 | | - | |
95 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
96 | 154 | | |
97 | 155 | | |
98 | 156 | | |
| |||
195 | 253 | | |
196 | 254 | | |
197 | 255 | | |
198 | | - | |
199 | | - | |
200 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | | - | |
110 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
111 | 125 | | |
112 | 126 | | |
113 | 127 | | |
114 | 128 | | |
115 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
116 | 135 | | |
117 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
118 | 143 | | |
119 | 144 | | |
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
123 | 148 | | |
| 149 | + | |
| 150 | + | |
124 | 151 | | |
125 | | - | |
126 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
127 | 160 | | |
128 | 161 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
132 | 180 | | |
133 | 181 | | |
134 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
77 | 106 | | |
78 | 107 | | |
79 | 108 | | |
| |||
91 | 120 | | |
92 | 121 | | |
93 | 122 | | |
94 | | - | |
| 123 | + | |
95 | 124 | | |
96 | 125 | | |
97 | 126 | | |
98 | 127 | | |
| 128 | + | |
99 | 129 | | |
100 | 130 | | |
101 | 131 | | |
102 | 132 | | |
103 | 133 | | |
104 | 134 | | |
| 135 | + | |
105 | 136 | | |
106 | 137 | | |
107 | 138 | | |
108 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
109 | 144 | | |
110 | 145 | | |
111 | 146 | | |
112 | 147 | | |
| 148 | + | |
113 | 149 | | |
114 | 150 | | |
115 | 151 | | |
| |||
143 | 179 | | |
144 | 180 | | |
145 | 181 | | |
| 182 | + | |
146 | 183 | | |
147 | 184 | | |
148 | 185 | | |
| |||
174 | 211 | | |
175 | 212 | | |
176 | 213 | | |
| 214 | + | |
177 | 215 | | |
178 | 216 | | |
179 | 217 | | |
| |||
188 | 226 | | |
189 | 227 | | |
190 | 228 | | |
191 | | - | |
| 229 | + | |
0 commit comments