@mailwoman/registry 5.9.0 → 5.10.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.
- package/out/address-key.d.ts +1 -1
- package/out/geocode-handler.d.ts +2 -2
- package/out/geojson.d.ts +1 -1
- package/out/index.d.ts +10 -10
- package/out/ingest.d.ts +1 -1
- package/out/learned-scorer.d.ts +2 -2
- package/out/learned-scorer.js +1 -1
- package/out/map-html.d.ts +1 -1
- package/out/reconcile.d.ts +2 -2
- package/out/reconcile.js +1 -1
- package/out/resolve.d.ts +1 -1
- package/out/tools/coverage-reconciliation.d.ts +51 -0
- package/out/tools/coverage-reconciliation.d.ts.map +1 -0
- package/out/tools/coverage-reconciliation.js +166 -0
- package/out/tools/coverage-reconciliation.js.map +1 -0
- package/out/tools/cross-dataset-correlation.d.ts +49 -0
- package/out/tools/cross-dataset-correlation.d.ts.map +1 -0
- package/out/tools/cross-dataset-correlation.js +340 -0
- package/out/tools/cross-dataset-correlation.js.map +1 -0
- package/out/tools/cross-source-threshold-sweep.d.ts +52 -0
- package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/cross-source-threshold-sweep.js +328 -0
- package/out/tools/cross-source-threshold-sweep.js.map +1 -0
- package/out/tools/dedup-ceiling.d.ts +21 -3
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +16 -30
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +45 -0
- package/out/tools/eval-geocoder.d.ts.map +1 -0
- package/out/tools/eval-geocoder.js +14 -0
- package/out/tools/eval-geocoder.js.map +1 -0
- package/out/tools/geocoder-namesake-probe.d.ts +26 -0
- package/out/tools/geocoder-namesake-probe.d.ts.map +1 -0
- package/out/tools/geocoder-namesake-probe.js +59 -0
- package/out/tools/geocoder-namesake-probe.js.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts +38 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.js +132 -0
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -0
- package/out/tools/gold-set-sample.d.ts +22 -3
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +17 -32
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +36 -0
- package/out/tools/index.d.ts.map +1 -0
- package/out/tools/index.js +36 -0
- package/out/tools/index.js.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts +54 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.js +368 -0
- package/out/tools/learned-scorer-clustering-eval.js.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts +43 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.js +305 -0
- package/out/tools/learned-scorer-crossstate-eval.js.map +1 -0
- package/out/tools/learned-scorer-eval.d.ts +59 -0
- package/out/tools/learned-scorer-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-eval.js +450 -0
- package/out/tools/learned-scorer-eval.js.map +1 -0
- package/out/tools/matcher-scale.d.ts +17 -3
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +14 -30
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes-dedup-benchmark.d.ts +75 -0
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -0
- package/out/tools/nppes-dedup-benchmark.js +846 -0
- package/out/tools/nppes-dedup-benchmark.js.map +1 -0
- package/out/tools/train-cross-gbt.d.ts +58 -0
- package/out/tools/train-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-cross-gbt.js +324 -0
- package/out/tools/train-cross-gbt.js.map +1 -0
- package/out/tools/train-gbt.d.ts +51 -0
- package/out/tools/train-gbt.d.ts.map +1 -0
- package/out/tools/train-gbt.js +268 -0
- package/out/tools/train-gbt.js.map +1 -0
- package/out/tools/train-org-cross-gbt.d.ts +51 -0
- package/out/tools/train-org-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-org-cross-gbt.js +296 -0
- package/out/tools/train-org-cross-gbt.js.map +1 -0
- package/out/tools/txhhsc-to-oarow.d.ts +14 -3
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +44 -52
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +23 -4
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +42 -46
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +17 -4
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +71 -78
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render-map.d.ts +17 -3
- package/out/tools/viz/render-map.d.ts.map +1 -1
- package/out/tools/viz/render-map.js +26 -26
- package/out/tools/viz/render-map.js.map +1 -1
- package/out/tools/viz/render.d.ts +21 -3
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +43 -39
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +24 -5
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +53 -62
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +11 -3
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +68 -73
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/package.json +50 -10
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
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).
|
|
13
|
+
*
|
|
14
|
+
* One registry pass builds the global address-frequency table + a TRAIN-state sample + an
|
|
15
|
+
* EVAL-state sample; both are geocoded; the GBT + LR are trained on the train state's pairs and
|
|
16
|
+
* used to cluster the eval state's records through the same `resolveEntities` pipeline (FS
|
|
17
|
+
* baseline / GBT scorer / LR scorer), best F1 over a fine per-scorer threshold sweep. The metric
|
|
18
|
+
* is the dedup benchmark's clustering F1.
|
|
19
|
+
*
|
|
20
|
+
* Run: `mailwoman registry scorer-eval cross-state [--train-state TX] [--eval-state CA]
|
|
21
|
+
* [--npis 2000] [--out-md <md>]`
|
|
22
|
+
*/
|
|
23
|
+
import { writeFileSync } from "node:fs";
|
|
24
|
+
import { dataRootPath } from "@mailwoman/core/utils";
|
|
25
|
+
import { block, gbtScore, trainGBT } from "@mailwoman/match";
|
|
26
|
+
import { addressFrequencyKey, buildDefaultModel, createGbtScorer, createMatchFeaturizer, DEDUP_GBT_MODEL, defaultBlockingKeys, ingestRows, resolveEntities, streamRows, } from "@mailwoman/registry";
|
|
27
|
+
const C = {
|
|
28
|
+
npi: "NPI",
|
|
29
|
+
entityType: "Entity Type Code",
|
|
30
|
+
orgLegal: "Provider Organization Name (Legal Business Name)",
|
|
31
|
+
last: "Provider Last Name (Legal Name)",
|
|
32
|
+
first: "Provider First Name",
|
|
33
|
+
pAddr: "Provider First Line Business Practice Location Address",
|
|
34
|
+
pCity: "Provider Business Practice Location Address City Name",
|
|
35
|
+
pState: "Provider Business Practice Location Address State Name",
|
|
36
|
+
pZip: "Provider Business Practice Location Address Postal Code",
|
|
37
|
+
mAddr: "Provider First Line Business Mailing Address",
|
|
38
|
+
mCity: "Provider Business Mailing Address City Name",
|
|
39
|
+
mState: "Provider Business Mailing Address State Name",
|
|
40
|
+
mZip: "Provider Business Mailing Address Postal Code",
|
|
41
|
+
otherOrg: "Provider Other Organization Name",
|
|
42
|
+
};
|
|
43
|
+
const norm = (s) => (s ?? "").trim();
|
|
44
|
+
const addr = (line, city, st, zip) => [norm(line), norm(city), norm(st), norm(zip)].filter(Boolean).join(", ");
|
|
45
|
+
const choose2 = (n) => (n * (n - 1)) / 2;
|
|
46
|
+
/** The dedup benchmark's pairwise clustering metric vs the NPI grouping (record.id = NPI). */
|
|
47
|
+
function scoreClusters(entities) {
|
|
48
|
+
const npiTotals = new Map();
|
|
49
|
+
let sumCK = 0;
|
|
50
|
+
let sumCluster = 0;
|
|
51
|
+
let overMerged = 0;
|
|
52
|
+
for (const e of entities) {
|
|
53
|
+
const byNPI = new Map();
|
|
54
|
+
for (const rec of e.records) {
|
|
55
|
+
byNPI.set(rec.id, (byNPI.get(rec.id) ?? 0) + 1);
|
|
56
|
+
}
|
|
57
|
+
sumCluster += choose2(e.records.length);
|
|
58
|
+
if (byNPI.size > 1) {
|
|
59
|
+
overMerged++;
|
|
60
|
+
}
|
|
61
|
+
for (const [npi, c] of byNPI) {
|
|
62
|
+
sumCK += choose2(c);
|
|
63
|
+
npiTotals.set(npi, (npiTotals.get(npi) ?? 0) + c);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let sumClass = 0;
|
|
67
|
+
for (const total of npiTotals.values()) {
|
|
68
|
+
sumClass += choose2(total);
|
|
69
|
+
}
|
|
70
|
+
const tp = sumCK;
|
|
71
|
+
const precision = sumCluster > 0 ? tp / sumCluster : 0;
|
|
72
|
+
const recall = sumClass > 0 ? tp / sumClass : 0;
|
|
73
|
+
const f1 = precision + recall > 0 ? (2 * precision * recall) / (precision + recall) : 0;
|
|
74
|
+
return { precision, recall, f1, overMerged };
|
|
75
|
+
}
|
|
76
|
+
/** Learned-scorer cross-state generalization (#603 Tier 2) — see the module doc. Emits the report to stdout. */
|
|
77
|
+
export async function scorerCrossStateEval(options, report) {
|
|
78
|
+
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
79
|
+
const TRAIN_STATE = (options.trainState || "TX").toUpperCase();
|
|
80
|
+
const EVAL_STATE = (options.evalState || "CA").toUpperCase();
|
|
81
|
+
const NPIS = options.npis ?? 2000;
|
|
82
|
+
const OUT_MD = options.outMd || "";
|
|
83
|
+
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
84
|
+
const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`;
|
|
85
|
+
report?.("[A] streaming other-names…");
|
|
86
|
+
const altNames = new Map();
|
|
87
|
+
for await (const r of streamRows(OTHER_NAMES)) {
|
|
88
|
+
const npi = norm(r[C.npi]);
|
|
89
|
+
const alt = norm(r[C.otherOrg]);
|
|
90
|
+
if (!npi || !alt)
|
|
91
|
+
continue;
|
|
92
|
+
const list = altNames.get(npi) ?? [];
|
|
93
|
+
if (list.length < 5) {
|
|
94
|
+
list.push(alt);
|
|
95
|
+
}
|
|
96
|
+
altNames.set(npi, list);
|
|
97
|
+
}
|
|
98
|
+
// ONE registry pass: global address-frequency + a TRAIN-state sample + an EVAL-state sample.
|
|
99
|
+
report?.(`[B] registry pass: address-frequency + ${NPIS} ${TRAIN_STATE} (train) + ${NPIS} ${EVAL_STATE} (eval)…`);
|
|
100
|
+
const samples = {
|
|
101
|
+
[TRAIN_STATE]: { rows: [], kept: new Set() },
|
|
102
|
+
[EVAL_STATE]: { rows: [], kept: new Set() },
|
|
103
|
+
};
|
|
104
|
+
const addrCounts = new Map();
|
|
105
|
+
let addrTotal = 0;
|
|
106
|
+
let scanned = 0;
|
|
107
|
+
for await (const r of streamRows(REGISTRY)) {
|
|
108
|
+
if (++scanned % 1_000_000 === 0) {
|
|
109
|
+
report?.(` scanned ${scanned / 1e6}M`);
|
|
110
|
+
}
|
|
111
|
+
const practice = addr(r[C.pAddr], r[C.pCity], r[C.pState], r[C.pZip]);
|
|
112
|
+
if (practice) {
|
|
113
|
+
const k = addressFrequencyKey(practice);
|
|
114
|
+
addrCounts.set(k, (addrCounts.get(k) ?? 0) + 1);
|
|
115
|
+
addrTotal++;
|
|
116
|
+
}
|
|
117
|
+
const npi = norm(r[C.npi]);
|
|
118
|
+
const st = norm(r[C.pState]).toUpperCase();
|
|
119
|
+
const bucket = samples[st];
|
|
120
|
+
if (bucket && bucket.kept.size < NPIS && npi && !bucket.kept.has(npi) && altNames.has(npi) && practice) {
|
|
121
|
+
const isOrg = norm(r[C.entityType]) === "2";
|
|
122
|
+
const primaryName = isOrg ? norm(r[C.orgLegal]) : `${norm(r[C.first])} ${norm(r[C.last])}`.trim();
|
|
123
|
+
if (primaryName) {
|
|
124
|
+
const org = isOrg ? norm(r[C.orgLegal]) : "";
|
|
125
|
+
bucket.kept.add(npi);
|
|
126
|
+
bucket.rows.push({ npi, name: primaryName, org, address: practice });
|
|
127
|
+
for (const alt of altNames.get(npi)) {
|
|
128
|
+
bucket.rows.push({ npi, name: alt, org: alt, address: practice });
|
|
129
|
+
}
|
|
130
|
+
const mailing = addr(r[C.mAddr], r[C.mCity], r[C.mState], r[C.mZip]);
|
|
131
|
+
if (mailing && mailing !== practice) {
|
|
132
|
+
bucket.rows.push({ npi, name: primaryName, org, address: mailing });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const addressFrequency = {
|
|
138
|
+
total: addrTotal,
|
|
139
|
+
distinct: addrCounts.size,
|
|
140
|
+
frequency: (v) => (v ? (addrCounts.get(addressFrequencyKey(v)) ?? 0) / addrTotal : 0),
|
|
141
|
+
};
|
|
142
|
+
report?.(` ${TRAIN_STATE}: ${samples[TRAIN_STATE].kept.size} NPIs → ${samples[TRAIN_STATE].rows.length} records · ` +
|
|
143
|
+
`${EVAL_STATE}: ${samples[EVAL_STATE].kept.size} NPIs → ${samples[EVAL_STATE].rows.length} records`);
|
|
144
|
+
report?.("[C] geocoding both states…");
|
|
145
|
+
const geocoder = await options.createGeocoder();
|
|
146
|
+
const mapping = { id: "npi", name: "name", organization: "org", address: "address", source: "nppes" };
|
|
147
|
+
const geocodeRows = (rows) => ingestRows(rows, mapping, { geocodeAddress: geocoder.seam });
|
|
148
|
+
const trainRecords = await geocodeRows(samples[TRAIN_STATE].rows);
|
|
149
|
+
const evalRecords = await geocodeRows(samples[EVAL_STATE].rows);
|
|
150
|
+
geocoder.close();
|
|
151
|
+
// Feature basis: the SHARED production featurizer (train ≡ eval ≡ inference, one definition) over the
|
|
152
|
+
// collapsed-spatial + address-frequency comparison set (the baseline).
|
|
153
|
+
const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons;
|
|
154
|
+
const featurize = createMatchFeaturizer({ comparisons, addressFrequency });
|
|
155
|
+
report?.(`[D] training GBT + LR on ${TRAIN_STATE} pairs…`);
|
|
156
|
+
const { pairs: trainPairs } = block(trainRecords, defaultBlockingKeys());
|
|
157
|
+
const trainX = trainPairs.map(([a, b]) => featurize(a, b));
|
|
158
|
+
const trainY = trainPairs.map(([a, b]) => (a.id === b.id ? 1 : 0));
|
|
159
|
+
const posRate = trainY.reduce((s, v) => s + v, 0) / Math.max(1, trainY.length);
|
|
160
|
+
const trainW = trainY.map((y) => (y === 1 ? 1 - posRate : posRate));
|
|
161
|
+
const dim = trainX[0]?.length ?? 0;
|
|
162
|
+
const gbt = trainGBT(trainX, trainY, trainW, { rounds: 120, depth: 3, lr: 0.3, minLeaf: 20 });
|
|
163
|
+
const w = new Array(dim).fill(0);
|
|
164
|
+
let bias = 0;
|
|
165
|
+
const sigmoid = (z) => 1 / (1 + Math.exp(-Math.max(-30, Math.min(30, z))));
|
|
166
|
+
for (let epoch = 0; epoch < 400; epoch++) {
|
|
167
|
+
const gw = new Array(dim).fill(0);
|
|
168
|
+
let gb = 0;
|
|
169
|
+
for (let i = 0; i < trainX.length; i++) {
|
|
170
|
+
let z = bias;
|
|
171
|
+
for (let j = 0; j < dim; j++) {
|
|
172
|
+
z += w[j] * trainX[i][j];
|
|
173
|
+
}
|
|
174
|
+
const err = (sigmoid(z) - trainY[i]) * trainW[i];
|
|
175
|
+
for (let j = 0; j < dim; j++) {
|
|
176
|
+
gw[j] += err * trainX[i][j];
|
|
177
|
+
}
|
|
178
|
+
gb += err;
|
|
179
|
+
}
|
|
180
|
+
for (let j = 0; j < dim; j++) {
|
|
181
|
+
w[j] -= 0.1 * (gw[j] / trainX.length + 1e-3 * w[j]);
|
|
182
|
+
}
|
|
183
|
+
bias -= 0.1 * (gb / trainX.length);
|
|
184
|
+
}
|
|
185
|
+
const lrSc = (x) => {
|
|
186
|
+
let z = bias;
|
|
187
|
+
for (let j = 0; j < x.length; j++) {
|
|
188
|
+
z += w[j] * x[j];
|
|
189
|
+
}
|
|
190
|
+
return z;
|
|
191
|
+
};
|
|
192
|
+
const gbtScorer = (a, b) => gbtScore(gbt, featurize(a, b));
|
|
193
|
+
const lrScorer = (a, b) => lrSc(featurize(a, b));
|
|
194
|
+
report?.(`[E] clustering ${EVAL_STATE} records (FS baseline vs GBT vs LR, trained on ${TRAIN_STATE})…`);
|
|
195
|
+
const bestOver = (thresholds, cfg) => {
|
|
196
|
+
let best = { precision: 0, recall: 0, f1: -1, overMerged: 0 };
|
|
197
|
+
for (const t of thresholds) {
|
|
198
|
+
const s = scoreClusters(resolveEntities(evalRecords, cfg(t)).entities);
|
|
199
|
+
if (s.f1 > best.f1) {
|
|
200
|
+
best = s;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return best;
|
|
204
|
+
};
|
|
205
|
+
const { pairs: evalPairs } = block(evalRecords, defaultBlockingKeys());
|
|
206
|
+
const quantileThresholds = (scores) => {
|
|
207
|
+
const sorted = [...scores].sort((p, q) => p - q);
|
|
208
|
+
const ts = new Set();
|
|
209
|
+
for (let k = 0; k <= 32; k++) {
|
|
210
|
+
ts.add(sorted[Math.floor((0.2 + (0.999 - 0.2) * (k / 32)) * (sorted.length - 1))]);
|
|
211
|
+
}
|
|
212
|
+
return [...ts];
|
|
213
|
+
};
|
|
214
|
+
const fs = bestOver(Array.from({ length: 26 }, (_, i) => i),
|
|
215
|
+
// learnedScorer:false — the FS baseline is the baseline (the learned scorer is now default-on, so
|
|
216
|
+
// without this the "FS arm" would silently BE the GBT).
|
|
217
|
+
(t) => ({ addressFrequency, collapseSpatial: true, trainEM: true, threshold: t, learnedScorer: false }));
|
|
218
|
+
const gbtArm = bestOver(quantileThresholds(evalPairs.map(([a, b]) => gbtScorer(a, b))), (t) => ({
|
|
219
|
+
addressFrequency,
|
|
220
|
+
collapseSpatial: true,
|
|
221
|
+
scorer: gbtScorer,
|
|
222
|
+
threshold: t,
|
|
223
|
+
}));
|
|
224
|
+
const lrArm = bestOver(quantileThresholds(evalPairs.map(([a, b]) => lrScorer(a, b))), (t) => ({
|
|
225
|
+
addressFrequency,
|
|
226
|
+
collapseSpatial: true,
|
|
227
|
+
scorer: lrScorer,
|
|
228
|
+
threshold: t,
|
|
229
|
+
}));
|
|
230
|
+
// The SHIPPED model (the default-on candidate): the bundled DEDUP_GBT_MODEL, NOT a fresh per-run TX
|
|
231
|
+
// fit. This is the arm that justifies flipping `learnedScorer` default-on — the actual artifact every
|
|
232
|
+
// caller would get, evaluated on a state it never trained on.
|
|
233
|
+
const bundledScorer = createGbtScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency });
|
|
234
|
+
const bundledArm = bestOver(quantileThresholds(evalPairs.map(([a, b]) => bundledScorer(a, b))), (t) => ({
|
|
235
|
+
addressFrequency,
|
|
236
|
+
collapseSpatial: true,
|
|
237
|
+
scorer: bundledScorer,
|
|
238
|
+
threshold: t,
|
|
239
|
+
}));
|
|
240
|
+
const dBundled = bundledArm.f1 - fs.f1;
|
|
241
|
+
// NOTE(phase4): local pct keeps the fraction-in/no-%-suffix shape — not core formatPercent's
|
|
242
|
+
// numerator/denominator contract (call sites append their own "%").
|
|
243
|
+
const pct = (x) => (100 * x).toFixed(1);
|
|
244
|
+
const sgn = (x) => (x >= 0 ? "+" : "");
|
|
245
|
+
const dGbt = gbtArm.f1 - fs.f1;
|
|
246
|
+
const dLr = lrArm.f1 - fs.f1;
|
|
247
|
+
report?.(` FS ${pct(fs.f1)}% · LR ${pct(lrArm.f1)}% (${sgn(dLr)}${pct(dLr)}) · GBT ${pct(gbtArm.f1)}% (${sgn(dGbt)}${pct(dGbt)})` +
|
|
248
|
+
` · BUNDLED ${pct(bundledArm.f1)}% (${sgn(dBundled)}${pct(dBundled)})`);
|
|
249
|
+
const row = (label, a, d, bold) => {
|
|
250
|
+
const dCell = d === null ? "—" : `${sgn(d * 100)}${(d * 100).toFixed(1)}pp`;
|
|
251
|
+
const f1 = bold ? `**${pct(a.f1)}%**` : `${pct(a.f1)}%`;
|
|
252
|
+
return `| ${bold ? `**${label}**` : label} | ${pct(a.precision)}% | ${pct(a.recall)}% | ${f1} | ${bold ? `**${dCell}**` : dCell} | ${a.overMerged} |`;
|
|
253
|
+
};
|
|
254
|
+
const lines = [];
|
|
255
|
+
lines.push(`# Learned-scorer CROSS-STATE generalization (#603 Tier 2) — train ${TRAIN_STATE}, evaluate ${EVAL_STATE}`);
|
|
256
|
+
lines.push("");
|
|
257
|
+
lines.push(`_Generated by \`mailwoman registry scorer-eval cross-state\`. The GBT + LR are trained on ` +
|
|
258
|
+
`${samples[TRAIN_STATE].kept.size} ${TRAIN_STATE} NPIs (${trainRecords.length} records) and used to cluster ` +
|
|
259
|
+
`${samples[EVAL_STATE].kept.size} held-out ${EVAL_STATE} NPIs (${evalRecords.length} records) — a state the model ` +
|
|
260
|
+
`never saw — through the same \`resolveEntities\` pipeline (FS baseline / GBT scorer / LR scorer), best F1 over a fine ` +
|
|
261
|
+
`per-scorer threshold sweep. This is the generalization axis the within-state held-out-NPI A/B couldn't cover._`);
|
|
262
|
+
lines.push("");
|
|
263
|
+
lines.push(`## Result — ${EVAL_STATE} clustering F1 (GBT/LR trained on ${TRAIN_STATE})`);
|
|
264
|
+
lines.push("");
|
|
265
|
+
lines.push(`| scorer | precision | recall | F1 | ΔF1 vs FS | over-merged |`);
|
|
266
|
+
lines.push(`|---|---:|---:|---:|---:|---:|`);
|
|
267
|
+
lines.push(row("FS baseline (EM-fit)", fs, null, false));
|
|
268
|
+
lines.push(row("logistic regression", lrArm, dLr, false));
|
|
269
|
+
lines.push(row(`GBT (fresh ${TRAIN_STATE} fit)`, gbtArm, dGbt, false));
|
|
270
|
+
lines.push(row("SHIPPED bundled model (default-on candidate)", bundledArm, dBundled, true));
|
|
271
|
+
lines.push("");
|
|
272
|
+
lines.push(`The **bundled** row is the actual shipped \`DEDUP_GBT_MODEL\` (the default-on candidate), evaluated on ` +
|
|
273
|
+
`${EVAL_STATE} — a state it never trained on. The "fresh ${TRAIN_STATE} fit" row retrains per run for comparison.`);
|
|
274
|
+
lines.push("");
|
|
275
|
+
const verdict = dGbt > 0.02
|
|
276
|
+
? `**The GBT win GENERALIZES across states** — trained on ${TRAIN_STATE}, it still beats the FS baseline on ${EVAL_STATE} ` +
|
|
277
|
+
`clustering F1 (${pct(gbtArm.f1)}% vs ${pct(fs.f1)}%, ${sgn(dGbt * 100)}${(dGbt * 100).toFixed(1)}pp). The learned scorer ` +
|
|
278
|
+
`isn't fitting ${TRAIN_STATE}-specific structure; the over-merge signal it learns transfers. This is the strongest ` +
|
|
279
|
+
`evidence yet for the #603 production GBM — one model, trained once, helps a state it never saw.`
|
|
280
|
+
: dGbt < -0.02
|
|
281
|
+
? `**The GBT win does NOT generalize** — trained on ${TRAIN_STATE}, it is WORSE than the FS baseline on ${EVAL_STATE} ` +
|
|
282
|
+
`(${pct(gbtArm.f1)}% vs ${pct(fs.f1)}%, ${(dGbt * 100).toFixed(1)}pp). The within-state gain was state-specific ` +
|
|
283
|
+
`structure; a production GBM would need per-state (or much broader) training. Important caveat for #603.`
|
|
284
|
+
: `**The GBT roughly TIES the FS baseline cross-state** (${pct(gbtArm.f1)}% vs ${pct(fs.f1)}%, ` +
|
|
285
|
+
`${sgn(dGbt * 100)}${(dGbt * 100).toFixed(1)}pp). The within-state win attenuates across states — partial ` +
|
|
286
|
+
`generalization. A production GBM likely needs broader/multi-state training to recover the full within-state margin.`;
|
|
287
|
+
lines.push(verdict);
|
|
288
|
+
lines.push("");
|
|
289
|
+
lines.push(`## Honest caveats`);
|
|
290
|
+
lines.push("");
|
|
291
|
+
lines.push(`A single train/eval state pair (${TRAIN_STATE}→${EVAL_STATE}), one geocoded sample each, a compact pure-Node GBT ` +
|
|
292
|
+
`(120 rounds, depth 3). The FS arm is the benchmark baseline (same model), so the comparison is fair. Absolute F1 ` +
|
|
293
|
+
`differs from the within-state A/B because the eval population + over-merge density differ by state. NPI-as-truth is ` +
|
|
294
|
+
`conservative. The within-state held-out-NPI A/B (\`scorer-eval clustering\`) is the companion; together ` +
|
|
295
|
+
`they bound the generalization question a production GBM must answer._`);
|
|
296
|
+
lines.push("");
|
|
297
|
+
const md = lines.join("\n");
|
|
298
|
+
console.log(md);
|
|
299
|
+
if (OUT_MD) {
|
|
300
|
+
writeFileSync(OUT_MD, md);
|
|
301
|
+
report?.(`[written] ${OUT_MD}`);
|
|
302
|
+
}
|
|
303
|
+
return { markdown: md };
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=learned-scorer-crossstate-eval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learned-scorer-crossstate-eval.js","sourceRoot":"","sources":["../../tools/learned-scorer-crossstate-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,YAAY,EAA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G,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK;gBAC/F,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+DAA+D;gBAC3G,qHAAqH,CAAA;IACzH,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACnB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CACT,mCAAmC,WAAW,IAAI,UAAU,uDAAuD;QAClH,mHAAmH;QACnH,sHAAsH;QACtH,0GAA0G;QAC1G,uEAAuE,CACxE,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QACzB,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Learned-scorer probe (#603) — does a model over the Fellegi-Sunter feature vector separate
|
|
7
|
+
* matches from non-matches BETTER than the FS scorer itself? This is the honest, rigorous answer
|
|
8
|
+
* to "is the learned-scorer path worth it?" before investing in a full GBM/training pipeline.
|
|
9
|
+
*
|
|
10
|
+
* The over-merge (co-located distinct providers fused; co-located same-entity name-drift split) is
|
|
11
|
+
* a FIELD-INTERACTION effect FS can't express: it scores each field independently. A learned
|
|
12
|
+
* model with INTERACTION features (spatial-agreement × name-disagreement) can. We test that
|
|
13
|
+
* directly, with a clean methodology — no clustering confound, no leakage:
|
|
14
|
+
*
|
|
15
|
+
* 1. Generate the same NPI-keyed records as the dedup benchmark (real registry + name-drift +
|
|
16
|
+
* address-variation), geocoded.
|
|
17
|
+
* 2. Block → candidate pairs. For each: the FS agreement pattern + engineered interaction features;
|
|
18
|
+
* the label is same-NPI.
|
|
19
|
+
* 3. Split the NPIs into train / test. A pair is train iff BOTH endpoints are train-NPIs, test iff
|
|
20
|
+
* both test-NPIs — so no NPI's records leak across the split.
|
|
21
|
+
* 4. Train TWO learned scorers on the train pairs: an L2 logistic regression (linear) and
|
|
22
|
+
* gradient-boosted shallow trees (non-linear — the model #603 names). Both pure-Node.
|
|
23
|
+
* 5. Score the test pairs with (a) the EM-fitted FS scorer, (b) the LR, (c) the GBT. Report pairwise
|
|
24
|
+
* ROC-AUC + best-threshold F1 for each, averaged over N seeds. AUC is threshold-free: does
|
|
25
|
+
* the learned scorer RANK matches above non-matches better than FS — and does the TREE beat
|
|
26
|
+
* the LINEAR model (i.e. is there non-linear signal the hand-crafted interaction features
|
|
27
|
+
* miss)?
|
|
28
|
+
*
|
|
29
|
+
* Honest caveats are printed: in-domain (TX), a modest sample, PAIRWISE (not the clustering
|
|
30
|
+
* metric). The definitive test is a GBM A/B on the dedup clustering metric with a
|
|
31
|
+
* train-TX/eval-held-out-state split (#603 Tier 2); this probe bounds the pairwise-ranking gain
|
|
32
|
+
* cheaply first.
|
|
33
|
+
*
|
|
34
|
+
* Run: `mailwoman registry scorer-eval pairwise [--npis 1500] [--seeds 8] [--wof <admin.db>]
|
|
35
|
+
* [--data-root <dir>] [--seed 1] [--out-md <md>]`
|
|
36
|
+
*/
|
|
37
|
+
import type { EvalGeocoderFactory } from "./eval-geocoder.ts";
|
|
38
|
+
/** Options for {@linkcode scorerPairwiseEval}. */
|
|
39
|
+
export interface ScorerPairwiseEvalOptions {
|
|
40
|
+
/** The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`). */
|
|
41
|
+
createGeocoder: EvalGeocoderFactory;
|
|
42
|
+
/** Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`. */
|
|
43
|
+
sources?: string;
|
|
44
|
+
/** State filter. Default TX. */
|
|
45
|
+
state?: string;
|
|
46
|
+
/** NPIs sampled. Default 1500. */
|
|
47
|
+
npis?: number;
|
|
48
|
+
/** Base PRNG seed. Default 1. */
|
|
49
|
+
seed?: number;
|
|
50
|
+
/** Train/test splits averaged. Default 8. */
|
|
51
|
+
seeds?: number;
|
|
52
|
+
/** Also write the markdown report here. */
|
|
53
|
+
outMd?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Learned-scorer pairwise probe (#603) — see the module doc. Emits the markdown report to stdout. */
|
|
56
|
+
export declare function scorerPairwiseEval(options: ScorerPairwiseEvalOptions, report?: (line: string) => void): Promise<{
|
|
57
|
+
markdown: string;
|
|
58
|
+
}>;
|
|
59
|
+
//# sourceMappingURL=learned-scorer-eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learned-scorer-eval.d.ts","sourceRoot":"","sources":["../../tools/learned-scorer-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,kDAAkD;AAClD,MAAM,WAAW,yBAAyB;IACzC,4GAA4G;IAC5G,cAAc,EAAE,mBAAmB,CAAA;IACnC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAyCD,sGAAsG;AACtG,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,yBAAyB,EAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0d/B"}
|