@mailwoman/registry 10.0.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +11 -14
  2. package/lib/address-key.ts +14 -10
  3. package/lib/geocode-handler.ts +7 -5
  4. package/lib/geojson.ts +13 -7
  5. package/lib/ingest.ts +70 -92
  6. package/lib/learned-scorer.ts +38 -44
  7. package/lib/map-html.ts +26 -72
  8. package/lib/models/crosssource-gbt-en-us.ts +9 -7
  9. package/lib/models/dedup-gbt-en-us.ts +9 -8
  10. package/lib/models/org-crosssource-gbt-en-us.ts +10 -8
  11. package/lib/reconcile.ts +45 -54
  12. package/lib/resolve.ts +187 -130
  13. package/lib/types.ts +35 -29
  14. package/out/address-key.d.ts +14 -10
  15. package/out/address-key.d.ts.map +1 -1
  16. package/out/address-key.js +14 -10
  17. package/out/address-key.js.map +1 -1
  18. package/out/geocode-handler.d.ts +6 -4
  19. package/out/geocode-handler.d.ts.map +1 -1
  20. package/out/geocode-handler.js +7 -5
  21. package/out/geocode-handler.js.map +1 -1
  22. package/out/geojson.d.ts +9 -5
  23. package/out/geojson.d.ts.map +1 -1
  24. package/out/geojson.js +13 -7
  25. package/out/geojson.js.map +1 -1
  26. package/out/ingest.d.ts +49 -76
  27. package/out/ingest.d.ts.map +1 -1
  28. package/out/ingest.js +37 -62
  29. package/out/ingest.js.map +1 -1
  30. package/out/learned-scorer.d.ts +29 -26
  31. package/out/learned-scorer.d.ts.map +1 -1
  32. package/out/learned-scorer.js +31 -39
  33. package/out/learned-scorer.js.map +1 -1
  34. package/out/map-html.d.ts +13 -32
  35. package/out/map-html.d.ts.map +1 -1
  36. package/out/map-html.js +11 -64
  37. package/out/map-html.js.map +1 -1
  38. package/out/models/crosssource-gbt-en-us.d.ts +9 -7
  39. package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
  40. package/out/models/crosssource-gbt-en-us.js +9 -7
  41. package/out/models/crosssource-gbt-en-us.js.map +1 -1
  42. package/out/models/dedup-gbt-en-us.d.ts +9 -8
  43. package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
  44. package/out/models/dedup-gbt-en-us.js +9 -8
  45. package/out/models/dedup-gbt-en-us.js.map +1 -1
  46. package/out/models/org-crosssource-gbt-en-us.d.ts +10 -8
  47. package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
  48. package/out/models/org-crosssource-gbt-en-us.js +10 -8
  49. package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
  50. package/out/reconcile.d.ts +36 -50
  51. package/out/reconcile.d.ts.map +1 -1
  52. package/out/reconcile.js +18 -42
  53. package/out/reconcile.js.map +1 -1
  54. package/out/resolve.d.ts +152 -91
  55. package/out/resolve.d.ts.map +1 -1
  56. package/out/resolve.js +67 -68
  57. package/out/resolve.js.map +1 -1
  58. package/out/tools/coverage-reconciliation.d.ts +23 -23
  59. package/out/tools/coverage-reconciliation.d.ts.map +1 -1
  60. package/out/tools/coverage-reconciliation.js +15 -26
  61. package/out/tools/coverage-reconciliation.js.map +1 -1
  62. package/out/tools/cross/dataset-correlation.d.ts +23 -27
  63. package/out/tools/cross/dataset-correlation.d.ts.map +1 -1
  64. package/out/tools/cross/dataset-correlation.js +9 -61
  65. package/out/tools/cross/dataset-correlation.js.map +1 -1
  66. package/out/tools/cross/source-threshold-sweep.d.ts +20 -26
  67. package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -1
  68. package/out/tools/cross/source-threshold-sweep.js +14 -40
  69. package/out/tools/cross/source-threshold-sweep.js.map +1 -1
  70. package/out/tools/dedup-ceiling.d.ts +23 -26
  71. package/out/tools/dedup-ceiling.d.ts.map +1 -1
  72. package/out/tools/dedup-ceiling.js +22 -41
  73. package/out/tools/dedup-ceiling.js.map +1 -1
  74. package/out/tools/eval-geocoder.d.ts +25 -16
  75. package/out/tools/eval-geocoder.d.ts.map +1 -1
  76. package/out/tools/eval-geocoder.js +5 -6
  77. package/out/tools/eval-geocoder.js.map +1 -1
  78. package/out/tools/geocoder/namesake-probe.d.ts +9 -8
  79. package/out/tools/geocoder/namesake-probe.d.ts.map +1 -1
  80. package/out/tools/geocoder/namesake-probe.js +6 -7
  81. package/out/tools/geocoder/namesake-probe.js.map +1 -1
  82. package/out/tools/geocoder/vs-provided-coords.d.ts +18 -15
  83. package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -1
  84. package/out/tools/geocoder/vs-provided-coords.js +30 -27
  85. package/out/tools/geocoder/vs-provided-coords.js.map +1 -1
  86. package/out/tools/gold-set-sample.d.ts +27 -18
  87. package/out/tools/gold-set-sample.d.ts.map +1 -1
  88. package/out/tools/gold-set-sample.js +18 -22
  89. package/out/tools/gold-set-sample.js.map +1 -1
  90. package/out/tools/learned/scorer/clustering-eval.d.ts +30 -27
  91. package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -1
  92. package/out/tools/learned/scorer/clustering-eval.js +28 -38
  93. package/out/tools/learned/scorer/clustering-eval.js.map +1 -1
  94. package/out/tools/learned/scorer/crossstate-eval.d.ts +24 -18
  95. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -1
  96. package/out/tools/learned/scorer/crossstate-eval.js +19 -25
  97. package/out/tools/learned/scorer/crossstate-eval.js.map +1 -1
  98. package/out/tools/learned/scorer/eval.d.ts +26 -39
  99. package/out/tools/learned/scorer/eval.d.ts.map +1 -1
  100. package/out/tools/learned/scorer/eval.js +11 -71
  101. package/out/tools/learned/scorer/eval.js.map +1 -1
  102. package/out/tools/matcher-scale.d.ts +12 -17
  103. package/out/tools/matcher-scale.d.ts.map +1 -1
  104. package/out/tools/matcher-scale.js +11 -29
  105. package/out/tools/matcher-scale.js.map +1 -1
  106. package/out/tools/nppes/dedup-benchmark.d.ts +22 -41
  107. package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -1
  108. package/out/tools/nppes/dedup-benchmark.js +21 -67
  109. package/out/tools/nppes/dedup-benchmark.js.map +1 -1
  110. package/out/tools/nppes/org-name.d.ts +5 -11
  111. package/out/tools/nppes/org-name.d.ts.map +1 -1
  112. package/out/tools/nppes/org-name.js +2 -9
  113. package/out/tools/nppes/org-name.js.map +1 -1
  114. package/out/tools/nppes/overmerge-packet.d.ts +15 -11
  115. package/out/tools/nppes/overmerge-packet.d.ts.map +1 -1
  116. package/out/tools/nppes/overmerge-packet.js +6 -7
  117. package/out/tools/nppes/overmerge-packet.js.map +1 -1
  118. package/out/tools/nppes/report.d.ts +17 -13
  119. package/out/tools/nppes/report.d.ts.map +1 -1
  120. package/out/tools/nppes/report.js +6 -14
  121. package/out/tools/nppes/report.js.map +1 -1
  122. package/out/tools/nppes/sample.d.ts +29 -18
  123. package/out/tools/nppes/sample.d.ts.map +1 -1
  124. package/out/tools/nppes/sample.js +24 -28
  125. package/out/tools/nppes/sample.js.map +1 -1
  126. package/out/tools/nppes/scoring.d.ts +7 -6
  127. package/out/tools/nppes/scoring.d.ts.map +1 -1
  128. package/out/tools/nppes/scoring.js +6 -5
  129. package/out/tools/nppes/scoring.js.map +1 -1
  130. package/out/tools/nppes/settings.d.ts +10 -7
  131. package/out/tools/nppes/settings.d.ts.map +1 -1
  132. package/out/tools/nppes/settings.js +16 -16
  133. package/out/tools/nppes/settings.js.map +1 -1
  134. package/out/tools/nppes/truth-grains.d.ts +36 -23
  135. package/out/tools/nppes/truth-grains.d.ts.map +1 -1
  136. package/out/tools/nppes/truth-grains.js +36 -20
  137. package/out/tools/nppes/truth-grains.js.map +1 -1
  138. package/out/tools/shared.d.ts +68 -72
  139. package/out/tools/shared.d.ts.map +1 -1
  140. package/out/tools/shared.js +50 -67
  141. package/out/tools/shared.js.map +1 -1
  142. package/out/tools/train/cross-gbt.d.ts +37 -26
  143. package/out/tools/train/cross-gbt.d.ts.map +1 -1
  144. package/out/tools/train/cross-gbt.js +14 -25
  145. package/out/tools/train/cross-gbt.js.map +1 -1
  146. package/out/tools/train/gbt.d.ts +36 -20
  147. package/out/tools/train/gbt.d.ts.map +1 -1
  148. package/out/tools/train/gbt.js +27 -31
  149. package/out/tools/train/gbt.js.map +1 -1
  150. package/out/tools/train/org-cross-gbt.d.ts +38 -24
  151. package/out/tools/train/org-cross-gbt.d.ts.map +1 -1
  152. package/out/tools/train/org-cross-gbt.js +18 -22
  153. package/out/tools/train/org-cross-gbt.js.map +1 -1
  154. package/out/tools/txhhsc-to-oarow.d.ts +14 -9
  155. package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
  156. package/out/tools/txhhsc-to-oarow.js +16 -15
  157. package/out/tools/txhhsc-to-oarow.js.map +1 -1
  158. package/out/tools/viz/browser.d.ts +6 -5
  159. package/out/tools/viz/browser.d.ts.map +1 -1
  160. package/out/tools/viz/browser.js +6 -5
  161. package/out/tools/viz/browser.js.map +1 -1
  162. package/out/tools/viz/cross-dataset-map.d.ts +7 -4
  163. package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
  164. package/out/tools/viz/cross-dataset-map.js +9 -6
  165. package/out/tools/viz/cross-dataset-map.js.map +1 -1
  166. package/out/tools/viz/geocode-first-surface.d.ts +11 -5
  167. package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
  168. package/out/tools/viz/geocode-first-surface.js +16 -11
  169. package/out/tools/viz/geocode-first-surface.js.map +1 -1
  170. package/out/tools/viz/render/map.d.ts +5 -5
  171. package/out/tools/viz/render/map.d.ts.map +1 -1
  172. package/out/tools/viz/render/map.js +6 -5
  173. package/out/tools/viz/render/map.js.map +1 -1
  174. package/out/tools/viz/{render/index.d.ts → render.d.ts} +13 -9
  175. package/out/tools/viz/render.d.ts.map +1 -0
  176. package/out/tools/viz/{render/index.js → render.js} +9 -8
  177. package/out/tools/viz/render.js.map +1 -0
  178. package/out/tools/viz/source-provenance-map.d.ts +19 -7
  179. package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
  180. package/out/tools/viz/source-provenance-map.js +11 -8
  181. package/out/tools/viz/source-provenance-map.js.map +1 -1
  182. package/out/tools/viz/yardstick-figure.d.ts +2 -21
  183. package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
  184. package/out/tools/viz/yardstick-figure.js +3 -39
  185. package/out/tools/viz/yardstick-figure.js.map +1 -1
  186. package/out/types.d.ts +35 -29
  187. package/out/types.d.ts.map +1 -1
  188. package/out/types.js +2 -2
  189. package/out/types.js.map +1 -1
  190. package/package.json +42 -185
  191. package/{lib/tools → tools}/coverage-reconciliation.ts +27 -30
  192. package/{lib/tools → tools}/cross/dataset-correlation.ts +35 -73
  193. package/{lib/tools → tools}/cross/source-threshold-sweep.ts +29 -46
  194. package/{lib/tools → tools}/dedup-ceiling.ts +34 -45
  195. package/tools/eval-geocoder.ts +77 -0
  196. package/{lib/tools → tools}/geocoder/namesake-probe.ts +9 -8
  197. package/{lib/tools → tools}/geocoder/vs-provided-coords.ts +40 -31
  198. package/{lib/tools → tools}/gold-set-sample.ts +35 -29
  199. package/{lib/tools → tools}/learned/scorer/clustering-eval.ts +49 -45
  200. package/{lib/tools → tools}/learned/scorer/crossstate-eval.ts +34 -30
  201. package/{lib/tools → tools}/learned/scorer/eval.ts +39 -78
  202. package/{lib/tools → tools}/matcher-scale.ts +21 -33
  203. package/{lib/tools → tools}/nppes/dedup-benchmark.ts +39 -83
  204. package/tools/nppes/org-name.ts +15 -0
  205. package/{lib/tools → tools}/nppes/overmerge-packet.ts +16 -12
  206. package/{lib/tools → tools}/nppes/report.ts +32 -25
  207. package/{lib/tools → tools}/nppes/sample.ts +43 -38
  208. package/{lib/tools → tools}/nppes/scoring.ts +7 -6
  209. package/{lib/tools → tools}/nppes/settings.ts +16 -16
  210. package/{lib/tools → tools}/nppes/truth-grains.ts +46 -26
  211. package/{lib/tools → tools}/shared.ts +79 -98
  212. package/{lib/tools → tools}/train/cross-gbt.ts +39 -34
  213. package/{lib/tools → tools}/train/gbt.ts +55 -41
  214. package/{lib/tools → tools}/train/org-cross-gbt.ts +40 -30
  215. package/{lib/tools → tools}/txhhsc-to-oarow.ts +24 -18
  216. package/{lib/tools → tools}/viz/browser.ts +6 -5
  217. package/{lib/tools → tools}/viz/cross-dataset-map.ts +15 -9
  218. package/{lib/tools → tools}/viz/geocode-first-surface.ts +29 -17
  219. package/{lib/tools → tools}/viz/render/map.ts +7 -6
  220. package/{lib/tools/viz/render/index.ts → tools/viz/render.ts} +16 -11
  221. package/{lib/tools → tools}/viz/source-provenance-map.ts +30 -15
  222. package/{lib/tools → tools}/viz/yardstick-figure.ts +6 -43
  223. package/lib/tools/eval-geocoder.ts +0 -67
  224. package/lib/tools/index.ts +0 -31
  225. package/lib/tools/nppes/org-name.ts +0 -23
  226. package/out/tools/index.d.ts +0 -31
  227. package/out/tools/index.d.ts.map +0 -1
  228. package/out/tools/index.js +0 -31
  229. package/out/tools/index.js.map +0 -1
  230. package/out/tools/viz/render/index.d.ts.map +0 -1
  231. package/out/tools/viz/render/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"gold-set-sample.d.ts","sourceRoot":"","sources":["../../lib/tools/gold-set-sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAgBD;;GAEG;AACH,wBAAsB,aAAa,CAClC,OAAO,GAAE,oBAAyB,EAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA8DjD"}
1
+ {"version":3,"file":"gold-set-sample.d.ts","sourceRoot":"","sources":["../../tools/gold-set-sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAgBD;;GAEG;AACH,wBAAsB,aAAa,CAClC,OAAO,GAAE,oBAAyB,EAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA0DjD"}
@@ -3,28 +3,28 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Gold-set P3 (#625) — sample the HARD slice for adjudication. The programmatic entity truth
7
- * (`nppes-dedup-benchmark.ts`) collapses only NPPES-FLAGGED subparts (Is-Subpart + parent
8
- * LBN/TIN); it can't settle the genuinely-ambiguous co-located collisions: distinct NPIs at one
9
- * address with near-identical names that are NOT flagged subparts of the same parent. Those are
10
- * where NPI-truth and any programmatic rule disagree — exactly the pairs a frozen adjudicated
11
- * gold set must cover.
6
+ * Gold-set sampling for adjudication. The programmatic entity truth
7
+ * (`nppes-dedup-benchmark.ts`) collapses only NPPES-flagged subparts (Is-Subpart plus parent
8
+ * LBN/TIN), so it cannot settle the genuinely ambiguous co-located collisions: distinct NPIs at
9
+ * one address with near-identical name text and no subpart flag for the same parent.
10
+ * NPI truth and programmatic rules may disagree on these pairs. A frozen
11
+ * adjudicated gold set must cover.
12
12
  *
13
- * This finds them (over the full TX registry, geocode-free — the shared co-location scan
14
- * `dedup-ceiling.ts` also runs) and writes each as a JSONL row carrying BOTH records' fields (org
15
- * name, address, authorized official, taxonomy, subpart/parent flags) plus the programmatic
16
- * verdict, so an adjudicator (human or LLM-as-judge, flagged as such) can label "same real-world
17
- * entity? yes/no" and we can MEASURE how often the programmatic truth matches judgment.
13
+ * This scans the full TX registry without geocoding and writes each pair as a JSONL row containing
14
+ * both records' fields (org name, address, authorized official, taxonomy, subpart and parent
15
+ * flags) plus the programmatic verdict. An adjudicator (human or LLM-as-judge, flagged as such)
16
+ * can then label same real-world entity or not.
18
17
  *
19
18
  * Run: `mailwoman registry gold-set-sample [--cap 200000] [--state TX] [--tau 0.7] [--n 300]
20
19
  * [--out-jsonl <path>]`
21
20
  */
22
21
  import { dataRootPath } from "@mailwoman/core/data-root";
23
- import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
22
+ import { writeLocalJSONLFile } from "@mailwoman/core/fs/writers";
23
+ import { stringifyJSON } from "@mailwoman/core/json";
24
24
  import { jaccard } from "@mailwoman/match";
25
25
  import { colocatedDistinctPairs, scanColocatedProviders, stateOption } from "#tools/shared";
26
26
  /**
27
- * Gold-set P3 (#625) — sample the HARD co-located name-collision slice for adjudication.
27
+ * Sample the hard co-located name-collision stratum for adjudication.
28
28
  */
29
29
  export async function goldSetSample(options = {}, report) {
30
30
  const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
@@ -37,8 +37,6 @@ export async function goldSetSample(options = {}, report) {
37
37
  report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`);
38
38
  const { byAddr, kept } = await scanColocatedProviders({ registryPath: REGISTRY, state: STATE, cap: CAP });
39
39
  report?.(` ${kept} providers at ${byAddr.size} addresses`);
40
- // Hard pairs: co-located, name-similar (≥τ), DISTINCT NPIs that programmatic truth can't confidently
41
- // collapse (NOT subparts of the same parent). Tag the programmatic verdict so adjudication can grade it.
42
40
  const hard = [];
43
41
  for (const { a, b } of colocatedDistinctPairs(byAddr)) {
44
42
  const sim = jaccard(a.tokens, b.tokens);
@@ -46,7 +44,7 @@ export async function goldSetSample(options = {}, report) {
46
44
  continue;
47
45
  const sameParent = a.subpart && b.subpart && a.parent === b.parent && a.parent !== "|";
48
46
  if (sameParent)
49
- continue; // programmatic truth already collapses these — not the hard slice
47
+ continue;
50
48
  const sameAuth = a.auth !== "" && a.auth === b.auth;
51
49
  const sameTax = a.taxonomy !== "" && a.taxonomy === b.taxonomy;
52
50
  hard.push({
@@ -59,25 +57,23 @@ export async function goldSetSample(options = {}, report) {
59
57
  sameAuthorizedOfficial: sameAuth,
60
58
  sameTaxonomy: sameTax,
61
59
  bothSubpartSameParent: false,
62
- // Programmatic heuristic verdict (what an entity-level rule WOULD say, beyond the flagged
63
- // subparts): same authorized official ⇒ likely one org; different official + different
64
- // specialty ⇒ likely distinct. The whole point is to ADJUDICATE whether this is right.
60
+ // The verdict records what an entity-level rule would say, so adjudication can grade it.
65
61
  programmaticVerdict: sameAuth ? "same-entity" : "distinct",
66
62
  adjudication: null,
67
63
  });
68
64
  }
69
65
  report?.(` ${hard.length} hard co-located name-collision pairs (non-flagged-subpart)`);
70
- // Deterministic spread sample of N (stride, not head — avoid file-order bias, the dedup-ceiling lesson).
66
+ // A deterministic stride sample avoids file-order bias in the adjudication set.
71
67
  const stride = Math.max(1, Math.floor(hard.length / N));
72
68
  const sample = hard.filter((_, i) => i % stride === 0).slice(0, N);
73
69
  report?.(` sampling ${sample.length} (stride ${stride}) for adjudication`);
74
70
  if (OUT) {
75
- await writeLocalTextFile(sample.map((p) => JSON.stringify(p)).join("\n") + "\n", OUT);
71
+ await writeLocalJSONLFile(sample, OUT);
76
72
  report?.(`[written] ${OUT}`);
77
73
  }
78
74
  else {
79
75
  for (const p of sample.slice(0, 10)) {
80
- console.log(JSON.stringify(p));
76
+ console.log(stringifyJSON(p));
81
77
  }
82
78
  }
83
79
  return { hardPairs: hard.length, sampled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CAAC,CAAC,CAAC,CAAA;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClE,MAAM,EAAE,CAAC,gBAAgB,MAAM,CAAC,MAAM,YAAY,MAAM,oBAAoB,CAAC,CAAA;IAE7E,IAAI,GAAG,EAAE,CAAC;QACT,MAAM,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACtC,MAAM,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,CAAA;IAC7B,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9B,CAAC;IACF,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;AAC1D,CAAC"}
@@ -3,26 +3,14 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Learned-scorer CLUSTERING A/B (#603 Tier 2) — the definitive test the pairwise probe
7
- * (`learned-scorer-eval.ts`) deferred. The probe showed a learned scorer ranks candidate pairs
8
- * better than Fellegi-Sunter (GBT +0.0177 AUC, +6.6pp pairwise F1); a better pairwise scorer need
9
- * NOT lift the assembled clustering F1 (clustering depends on the threshold +
10
- * connected-components). This measures the clustering F1 directly, leakage-free:
6
+ * Learned-scorer clustering A/B. A better pairwise scorer need not lift the assembled clustering F1,
7
+ * because that F1 depends on the threshold and connected components. This measures the clustering F1
8
+ * directly. It splits the NPIs into train and eval, trains a GBT and an LR on train pairs labeled by
9
+ * same NPI, then clusters the eval records three ways through the same `resolveEntities` pipeline
10
+ * (FS baseline, GBT scorer, LR scorer), sweeping the link threshold for each.
11
11
  *
12
- * 1. Sample NPI-keyed records (real registry + name-drift + address-variation), geocode once.
13
- * 2. Split the NPIs into TRAIN / EVAL. Train a GBT + an LR on pairs blocked among TRAIN records (label
14
- * = same-NPI). The eval NPIs' records are never seen in training.
15
- * 3. Cluster the EVAL records three ways via the SAME `resolveEntities` pipeline (block → score →
16
- * connected-components) — once with the FS baseline, once with the GBT as the link scorer
17
- * (the new `ResolveConfig.scorer` hook), once with the LR. Sweep the link threshold for
18
- * each; take best F1.
19
- * 4. Report the eval clustering F1 (the dedup benchmark's metric): does the learned scorer beat the FS
20
- * baseline on the ASSEMBLED output, not just pairwise ranking?
21
- *
22
- * The FS arm IS the benchmark's baseline (same model: address-frequency + collapsed spatial,
23
- * EM-fit), so the comparison is credible. Honest framing: in-domain (one state), a held-out-NPI
24
- * split (not a held-out STATE — generalization across states is the next axis), a compact
25
- * pure-Node GBT.
12
+ * The FS arm is the benchmark baseline (same model: address-frequency plus collapsed spatial,
13
+ * EM-fit), and the split is in-domain, held out by NPI rather than by state.
26
14
  *
27
15
  * Run: `mailwoman registry scorer-eval clustering [--npis 2000] [--split 0.67] [--seed 1]
28
16
  * [--out-md <md>]`
@@ -33,31 +21,45 @@ import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
33
21
  */
34
22
  export interface ScorerClusteringEvalOptions {
35
23
  /**
36
- * The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`).
24
+ * The injected geocoder factory.
25
+ *
26
+ * The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
37
27
  */
38
28
  createGeocoder: EvalGeocoderFactory;
39
29
  /**
40
- * Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`.
30
+ * Record-matcher sources directory.
31
+ *
32
+ * @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
41
33
  */
42
34
  sources?: string;
43
35
  /**
44
- * State filter. Default TX.
36
+ * State filter.
37
+ *
38
+ * @defaultValue TX.
45
39
  */
46
40
  state?: string;
47
41
  /**
48
- * NPIs sampled. Default 2000.
42
+ * NPIs sampled.
43
+ *
44
+ * @defaultValue `2000`
49
45
  */
50
46
  npis?: number;
51
47
  /**
52
- * Train fraction of the NPI split. Default 0.67.
48
+ * Train fraction of the NPI split.
49
+ *
50
+ * @defaultValue `0.67`
53
51
  */
54
52
  split?: number;
55
53
  /**
56
- * Base PRNG seed. Default 1.
54
+ * Base prng seed.
55
+ *
56
+ * @defaultValue `1`
57
57
  */
58
58
  seed?: number;
59
59
  /**
60
- * Held-out-NPI splits averaged. Default 4.
60
+ * Held-out-NPI splits averaged.
61
+ *
62
+ * @defaultValue `4`
61
63
  */
62
64
  seeds?: number;
63
65
  /**
@@ -66,7 +68,8 @@ export interface ScorerClusteringEvalOptions {
66
68
  outMd?: string;
67
69
  }
68
70
  /**
69
- * Learned-scorer clustering A/B (#603 Tier 2) — see the module doc. Emits the markdown report to stdout.
71
+ * Cluster the eval records with the FS baseline, GBT and LR.
72
+ * Emit the markdown report to stdout.
70
73
  */
71
74
  export declare function scorerClusteringEval(options: ScorerClusteringEvalOptions, report?: (line: string) => void): Promise<{
72
75
  markdown: string;
@@ -1 +1 @@
1
- {"version":3,"file":"clustering-eval.d.ts","sourceRoot":"","sources":["../../../../lib/tools/learned/scorer/clustering-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAgB/D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA+O/B"}
1
+ {"version":3,"file":"clustering-eval.d.ts","sourceRoot":"","sources":["../../../../tools/learned/scorer/clustering-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAgB/D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAgP/B"}
@@ -3,26 +3,14 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Learned-scorer CLUSTERING A/B (#603 Tier 2) — the definitive test the pairwise probe
7
- * (`learned-scorer-eval.ts`) deferred. The probe showed a learned scorer ranks candidate pairs
8
- * better than Fellegi-Sunter (GBT +0.0177 AUC, +6.6pp pairwise F1); a better pairwise scorer need
9
- * NOT lift the assembled clustering F1 (clustering depends on the threshold +
10
- * connected-components). This measures the clustering F1 directly, leakage-free:
6
+ * Learned-scorer clustering A/B. A better pairwise scorer need not lift the assembled clustering F1,
7
+ * because that F1 depends on the threshold and connected components. This measures the clustering F1
8
+ * directly. It splits the NPIs into train and eval, trains a GBT and an LR on train pairs labeled by
9
+ * same NPI, then clusters the eval records three ways through the same `resolveEntities` pipeline
10
+ * (FS baseline, GBT scorer, LR scorer), sweeping the link threshold for each.
11
11
  *
12
- * 1. Sample NPI-keyed records (real registry + name-drift + address-variation), geocode once.
13
- * 2. Split the NPIs into TRAIN / EVAL. Train a GBT + an LR on pairs blocked among TRAIN records (label
14
- * = same-NPI). The eval NPIs' records are never seen in training.
15
- * 3. Cluster the EVAL records three ways via the SAME `resolveEntities` pipeline (block → score →
16
- * connected-components) — once with the FS baseline, once with the GBT as the link scorer
17
- * (the new `ResolveConfig.scorer` hook), once with the LR. Sweep the link threshold for
18
- * each; take best F1.
19
- * 4. Report the eval clustering F1 (the dedup benchmark's metric): does the learned scorer beat the FS
20
- * baseline on the ASSEMBLED output, not just pairwise ranking?
21
- *
22
- * The FS arm IS the benchmark's baseline (same model: address-frequency + collapsed spatial,
23
- * EM-fit), so the comparison is credible. Honest framing: in-domain (one state), a held-out-NPI
24
- * split (not a held-out STATE — generalization across states is the next axis), a compact
25
- * pure-Node GBT.
12
+ * The FS arm is the benchmark baseline (same model: address-frequency plus collapsed spatial,
13
+ * EM-fit), and the split is in-domain, held out by NPI rather than by state.
26
14
  *
27
15
  * Run: `mailwoman registry scorer-eval clustering [--npis 2000] [--split 0.67] [--seed 1]
28
16
  * [--out-md <md>]`
@@ -37,7 +25,8 @@ import { buildNPPESSample } from "#tools/nppes/sample";
37
25
  import { scoreEntities } from "#tools/nppes/scoring";
38
26
  import { bestOver, MIN_MEANINGFUL_F1_DELTA, pct, quantileThresholds, sgn, stateOption, std, toArmScore, trainLogisticRegression, } from "#tools/shared";
39
27
  /**
40
- * Learned-scorer clustering A/B (#603 Tier 2) — see the module doc. Emits the markdown report to stdout.
28
+ * Cluster the eval records with the FS baseline, GBT and LR.
29
+ * Emit the markdown report to stdout.
41
30
  */
42
31
  export async function scorerClusteringEval(options, report) {
43
32
  const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
@@ -48,13 +37,12 @@ export async function scorerClusteringEval(options, report) {
48
37
  const OUT_MD = options.outMd || "";
49
38
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
50
39
  const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`;
51
- // Build the NPI-keyed benchmark sample and pairwise probe.
52
- // sample builder). ---
53
40
  const { rows, keptNpis: kept, addressFrequency, } = await buildNPPESSample({ registryPath: REGISTRY, otherNamesPath: OTHER_NAMES, state: STATE, maxNpis: NPIS }, report);
54
41
  report?.("[C] geocoding…");
55
42
  const geocoder = await options.createGeocoder();
56
- // `auth`/`taxonomy` ride as attributes so the SHARED featurizer's #625 roll-up features can read the
57
- // authorized official; the FS arm ignores them (no discriminators configured).
43
+ // `auth` and `taxonomy` ride as attributes so the shared featurizer's roll-up
44
+ // features can read the authorized official.
45
+ // The FS arm ignores them, since no discriminators are configured.
58
46
  const mapping = {
59
47
  id: "npi",
60
48
  name: "name",
@@ -67,18 +55,19 @@ export async function scorerClusteringEval(options, report) {
67
55
  geocodeAddress: geocoder.geocodeAddress,
68
56
  });
69
57
  geocoder[Symbol.dispose]();
70
- // Use address frequency and the collapsed-spatial model as the baseline feature basis.
71
- // pattern is EM-independent, so the same featurize() is consistent at train and inference time. ---
72
- // The featurizer is the SHARED production one (createMatchFeaturizer) — train ≡ eval ≡ inference, one
73
- // definition. Feed the collapsed-spatial + address-frequency comparison set (the benchmark baseline).
58
+ // The collapsed-spatial and address-frequency comparison set is the benchmark feature basis.
59
+ // The shared production featurizer keeps train, eval and inference on one definition.
60
+ // The agreement pattern is independent of EM, so features stay consistent at train and inference time.
74
61
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons;
75
62
  const featurize = createMatchFeaturizer({ comparisons, addressFrequency });
76
63
  const npiLabel = (rec) => rec.id;
77
64
  /**
78
- * One held-out-NPI split: train the GBT + LR on TRAIN pairs, then cluster the EVAL records three ways (FS baseline,
79
- * GBT scorer, LR scorer) through the same `resolveEntities` pipeline, sweeping the link threshold finely for each and
80
- * taking best F1. The geocode is shared across seeds; only the split, the trained scorers, and the eval subset move
81
- * with the seed.
65
+ * One held-out-NPI split: train the GBT and LR on train pairs, then cluster
66
+ * the eval records three ways through the same `resolveEntities` pipeline,
67
+ * sweeping the link threshold for each and taking best F1.
68
+ *
69
+ * The geocode is shared across seeds.
70
+ * Only the split, trained scorers and the eval subset move with the seed.
82
71
  */
83
72
  function runSeed(seed) {
84
73
  const rnd = makeLcg(seed || 1);
@@ -96,17 +85,18 @@ export async function scorerClusteringEval(options, report) {
96
85
  const trainW = trainY.map((y) => (y === 1 ? 1 - posRate : posRate));
97
86
  const dim = trainX[0]?.length ?? 0;
98
87
  const gbt = trainGBT(trainX, trainY, trainW, { rounds: 120, depth: 3, lr: 0.3, minLeaf: 20 });
99
- // LR (batch GD, class-balanced) — the SHARED trainer, same as the pairwise probe.
88
+ // LR (batch GD, class-balanced) through the shared trainer.
100
89
  const lrSc = trainLogisticRegression(trainX, trainY, trainW, dim);
101
90
  const gbtScorer = (a, b) => gbtScore(gbt, featurize(a, b));
102
91
  const lrScorer = (a, b) => lrSc(featurize(a, b));
103
92
  const armOver = (thresholds, cfg) => bestOver(thresholds, (t) => toArmScore(scoreEntities(resolveEntities(evalRecords, cfg(t)).entities, npiLabel, N)));
104
- // FS baseline: EM-fit weights in bits, fine grid [0..25]. Learned scorers: a FINE sweep from each
105
- // scorer's own eval-pair score distribution, so a coarse grid can't understate them.
93
+ // The FS baseline uses EM-fit weights in bits over a fine grid.
94
+ // Each learned scorer sweeps its own eval-pair score distribution,
95
+ // so a coarse grid cannot understate it.
106
96
  const { pairs: evalPairs } = block(evalRecords, defaultBlockingKeys());
107
97
  const fs = armOver(Array.from({ length: 26 }, (_, i) => i),
108
- // learnedScorer:false — the FS baseline is the baseline this A/B measures against (the learned scorer
109
- // is now default-on, so without this the "FS arm" would silently BE the GBT).
98
+ // learnedScorer false keeps the FS baseline.
99
+ // The learned scorer is default-on, so without this the FS arm would silently be the GBT.
110
100
  (t) => ({ addressFrequency, collapseSpatial: true, trainEM: true, threshold: t, learnedScorer: false }));
111
101
  const gbtArm = armOver(quantileThresholds(evalPairs.map(([a, b]) => gbtScorer(a, b))), (t) => ({
112
102
  addressFrequency,
@@ -203,7 +193,7 @@ export async function scorerClusteringEval(options, report) {
203
193
  `fair. The GBT is a compact pure-Node implementation (120 rounds, depth 3), not a tuned XGBoost/LightGBM — a real ` +
204
194
  `GBM with more NPIs/features could move the number further. Thresholds are swept per scorer (FS in bits, learned ` +
205
195
  `scorers in logits), each at its own best operating point — note a 300-NPI smoke MISLED (FS ahead): too few ` +
206
- `co-located collisions to exhibit the over-merge, which only bites at scale, so trust the larger eval. NPI-as-truth ` +
196
+ `co-located collisions to exhibit the over-merge. It only bites at scale. Therefore, trust the larger eval. NPI-as-truth ` +
207
197
  `is conservative (a cross-NPI merge is a candidate, not necessarily an error)._`);
208
198
  lines.push("");
209
199
  const md = lines.join("\n");
@@ -1 +1 @@
1
- {"version":3,"file":"clustering-eval.js","sourceRoot":"","sources":["../../../../lib/tools/learned/scorer/clustering-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EA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AC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACnG,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,KAAK,CAAC,IAAI,CACT,cAAc,KAAK,+FAA+F;QACjH,sHAAsH;QACtH,mHAAmH;QACnH,kHAAkH;QAClH,6GAA6G;QAC7G,0HAA0H;QAC1H,gFAAgF,CACjF,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAE3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAChC,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
@@ -3,19 +3,14 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Learned-scorer CROSS-STATE generalization (#603 Tier 2, the next axis after the held-out-NPI A/B
7
- * in `learned-scorer-clustering-eval.ts`). The held-out-NPI A/B showed the GBT beats the FS
8
- * baseline on clustering by +5.2pp — but the GBT was trained and evaluated within ONE state (TX).
9
- * The production question is whether that win GENERALIZES: train on one state, evaluate the dedup
10
- * clustering F1 on a DIFFERENT state the model never saw. If it holds, the GBM is
11
- * production-worthy; if it collapses, the scorer is fitting state-specific structure and needs
12
- * per-state training (a finding either way).
6
+ * Learned-scorer cross-state generalization, the next axis after the held-out-NPI A/B. The
7
+ * within-state A/B showed the GBT beats the FS baseline on clustering, so this trains on one state and
8
+ * evaluates clustering F1 on a different state the model never saw.
13
9
  *
14
- * One registry pass builds the global address-frequency table + a TRAIN-state sample + an
15
- * EVAL-state sample (the SHARED multi-state sample builder); both are geocoded; the GBT + LR are
16
- * trained on the train state's pairs and used to cluster the eval state's records through the
17
- * same `resolveEntities` pipeline (FS baseline / GBT scorer / LR scorer), best F1 over a fine
18
- * per-scorer threshold sweep. The metric is the dedup benchmark's clustering F1.
10
+ * One registry pass builds the global address-frequency table, a train-state sample and an
11
+ * eval-state sample. Both samples are geocoded. The GBT and LR train on the train state's pairs and
12
+ * cluster the eval state's records through the same `resolveEntities` pipeline, with best F1 over a
13
+ * fine per-scorer threshold sweep.
19
14
  *
20
15
  * Run: `mailwoman registry scorer-eval cross-state [--train-state TX] [--eval-state CA]
21
16
  * [--npis 2000] [--out-md <md>]`
@@ -26,23 +21,33 @@ import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
26
21
  */
27
22
  export interface ScorerCrossStateEvalOptions {
28
23
  /**
29
- * The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`).
24
+ * The injected geocoder factory.
25
+ *
26
+ * The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
30
27
  */
31
28
  createGeocoder: EvalGeocoderFactory;
32
29
  /**
33
- * Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`.
30
+ * Record-matcher sources directory.
31
+ *
32
+ * @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
34
33
  */
35
34
  sources?: string;
36
35
  /**
37
- * State the GBT/LR train on. Default TX.
36
+ * State the GBT/LR train on.
37
+ *
38
+ * @defaultValue TX.
38
39
  */
39
40
  trainState?: string;
40
41
  /**
41
- * Held-out state clustered. Default CA.
42
+ * Held-out state clustered.
43
+ *
44
+ * @defaultValue CA.
42
45
  */
43
46
  evalState?: string;
44
47
  /**
45
- * NPIs sampled per state. Default 2000.
48
+ * NPIs sampled per state.
49
+ *
50
+ * @defaultValue `2000`
46
51
  */
47
52
  npis?: number;
48
53
  /**
@@ -51,7 +56,8 @@ export interface ScorerCrossStateEvalOptions {
51
56
  outMd?: string;
52
57
  }
53
58
  /**
54
- * Learned-scorer cross-state generalization (#603 Tier 2) — see the module doc. Emits the report to stdout.
59
+ * Train on one state and cluster a different state's records.
60
+ * Emit the report to stdout.
55
61
  */
56
62
  export declare function scorerCrossStateEval(options: ScorerCrossStateEvalOptions, report?: (line: string) => void): Promise<{
57
63
  markdown: string;
@@ -1 +1 @@
1
- {"version":3,"file":"crossstate-eval.d.ts","sourceRoot":"","sources":["../../../../lib/tools/learned/scorer/crossstate-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAc/D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA2L/B"}
1
+ {"version":3,"file":"crossstate-eval.d.ts","sourceRoot":"","sources":["../../../../tools/learned/scorer/crossstate-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAc/D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAyL/B"}
@@ -3,19 +3,14 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Learned-scorer CROSS-STATE generalization (#603 Tier 2, the next axis after the held-out-NPI A/B
7
- * in `learned-scorer-clustering-eval.ts`). The held-out-NPI A/B showed the GBT beats the FS
8
- * baseline on clustering by +5.2pp — but the GBT was trained and evaluated within ONE state (TX).
9
- * The production question is whether that win GENERALIZES: train on one state, evaluate the dedup
10
- * clustering F1 on a DIFFERENT state the model never saw. If it holds, the GBM is
11
- * production-worthy; if it collapses, the scorer is fitting state-specific structure and needs
12
- * per-state training (a finding either way).
6
+ * Learned-scorer cross-state generalization, the next axis after the held-out-NPI A/B. The
7
+ * within-state A/B showed the GBT beats the FS baseline on clustering, so this trains on one state and
8
+ * evaluates clustering F1 on a different state the model never saw.
13
9
  *
14
- * One registry pass builds the global address-frequency table + a TRAIN-state sample + an
15
- * EVAL-state sample (the SHARED multi-state sample builder); both are geocoded; the GBT + LR are
16
- * trained on the train state's pairs and used to cluster the eval state's records through the
17
- * same `resolveEntities` pipeline (FS baseline / GBT scorer / LR scorer), best F1 over a fine
18
- * per-scorer threshold sweep. The metric is the dedup benchmark's clustering F1.
10
+ * One registry pass builds the global address-frequency table, a train-state sample and an
11
+ * eval-state sample. Both samples are geocoded. The GBT and LR train on the train state's pairs and
12
+ * cluster the eval state's records through the same `resolveEntities` pipeline, with best F1 over a
13
+ * fine per-scorer threshold sweep.
19
14
  *
20
15
  * Run: `mailwoman registry scorer-eval cross-state [--train-state TX] [--eval-state CA]
21
16
  * [--npis 2000] [--out-md <md>]`
@@ -28,7 +23,8 @@ import { buildNPPESStateSamples } from "#tools/nppes/sample";
28
23
  import { scoreEntities } from "#tools/nppes/scoring";
29
24
  import { bestOver, MIN_MEANINGFUL_F1_DELTA, pct, quantileThresholds, sgn, toArmScore, trainLogisticRegression, } from "#tools/shared";
30
25
  /**
31
- * Learned-scorer cross-state generalization (#603 Tier 2) — see the module doc. Emits the report to stdout.
26
+ * Train on one state and cluster a different state's records.
27
+ * Emit the report to stdout.
32
28
  */
33
29
  export async function scorerCrossStateEval(options, report) {
34
30
  const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
@@ -38,8 +34,6 @@ export async function scorerCrossStateEval(options, report) {
38
34
  const OUT_MD = options.outMd || "";
39
35
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
40
36
  const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`;
41
- // ONE registry pass fills BOTH state buckets (the SHARED multi-state sample builder): the global
42
- // address-frequency table + a TRAIN-state sample + an EVAL-state sample.
43
37
  const { byState, addressFrequency } = await buildNPPESStateSamples({
44
38
  registryPath: REGISTRY,
45
39
  otherNamesPath: OTHER_NAMES,
@@ -50,8 +44,9 @@ export async function scorerCrossStateEval(options, report) {
50
44
  const evalSample = byState.get(EVAL_STATE);
51
45
  report?.("[C] geocoding both states…");
52
46
  const geocoder = await options.createGeocoder();
53
- // `auth`/`taxonomy` ride as attributes so the SHARED featurizer's #625 roll-up features can read the
54
- // authorized official; the FS arm ignores them (no discriminators configured).
47
+ // `auth` and `taxonomy` ride as attributes so the shared featurizer's roll-up
48
+ // features can read the authorized official.
49
+ // The FS arm ignores them, since no discriminators are configured.
55
50
  const mapping = {
56
51
  id: "npi",
57
52
  name: "name",
@@ -63,8 +58,8 @@ export async function scorerCrossStateEval(options, report) {
63
58
  const trainRecords = await ingestRows(trainSample.rows, mapping, { geocodeAddress: geocoder.geocodeAddress });
64
59
  const evalRecords = await ingestRows(evalSample.rows, mapping, { geocodeAddress: geocoder.geocodeAddress });
65
60
  geocoder[Symbol.dispose]();
66
- // Feature basis: the SHARED production featurizer (train ≡ eval ≡ inference, one definition) over the
67
- // collapsed-spatial + address-frequency comparison set (the baseline).
61
+ // The shared production featurizer keeps train, eval and inference on one definition,
62
+ // over the collapsed-spatial and address-frequency comparison set.
68
63
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons;
69
64
  const featurize = createMatchFeaturizer({ comparisons, addressFrequency });
70
65
  report?.(`[D] training GBT + LR on ${TRAIN_STATE} pairs…`);
@@ -75,7 +70,7 @@ export async function scorerCrossStateEval(options, report) {
75
70
  const trainW = trainY.map((y) => (y === 1 ? 1 - posRate : posRate));
76
71
  const dim = trainX[0]?.length ?? 0;
77
72
  const gbt = trainGBT(trainX, trainY, trainW, { rounds: 120, depth: 3, lr: 0.3, minLeaf: 20 });
78
- // LR (batch GD, class-balanced) — the SHARED trainer.
73
+ // LR (batch GD, class-balanced) through the shared trainer.
79
74
  const lrSc = trainLogisticRegression(trainX, trainY, trainW, dim);
80
75
  const gbtScorer = (a, b) => gbtScore(gbt, featurize(a, b));
81
76
  const lrScorer = (a, b) => lrSc(featurize(a, b));
@@ -84,8 +79,8 @@ export async function scorerCrossStateEval(options, report) {
84
79
  const armOver = (thresholds, cfg) => bestOver(thresholds, (t) => toArmScore(scoreEntities(resolveEntities(evalRecords, cfg(t)).entities, npiLabel, evalRecords.length)));
85
80
  const { pairs: evalPairs } = block(evalRecords, defaultBlockingKeys());
86
81
  const fs = armOver(Array.from({ length: 26 }, (_, i) => i),
87
- // learnedScorer:false — the FS baseline is the baseline (the learned scorer is now default-on, so
88
- // without this the "FS arm" would silently BE the GBT).
82
+ // learnedScorer false keeps the FS baseline.
83
+ // The learned scorer is default-on, so without this the FS arm would silently be the GBT.
89
84
  (t) => ({ addressFrequency, collapseSpatial: true, trainEM: true, threshold: t, learnedScorer: false }));
90
85
  const gbtArm = armOver(quantileThresholds(evalPairs.map(([a, b]) => gbtScorer(a, b))), (t) => ({
91
86
  addressFrequency,
@@ -99,9 +94,8 @@ export async function scorerCrossStateEval(options, report) {
99
94
  scorer: lrScorer,
100
95
  threshold: t,
101
96
  }));
102
- // The SHIPPED model (the default-on candidate): the bundled DEDUP_GBT_MODEL, NOT a fresh per-run TX
103
- // fit. This is the arm that justifies flipping `learnedScorer` default-on — the actual artifact every
104
- // caller would get, evaluated on a state it never trained on.
97
+ // The bundled DEDUP_GBT_MODEL is the shipped artifact every caller receives,
98
+ // evaluated here on a state it never trained on.
105
99
  const bundledScorer = createGBTScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency });
106
100
  const bundledArm = armOver(quantileThresholds(evalPairs.map(([a, b]) => bundledScorer(a, b))), (t) => ({
107
101
  addressFrequency,