Publish Next-Ask space
Browse files- README.md +65 -4
- app.js +92 -0
- core.js +115 -0
- curves.json +1 -0
- digits.json +0 -0
- evaluation.json +509 -0
- index.html +57 -17
- model.json +1 -0
- nlrt.js +219 -0
- nlui.js +123 -0
- parity_cases.json +1 -0
- preview.png +0 -0
- style.css +53 -26
README.md
CHANGED
|
@@ -1,10 +1,71 @@
|
|
| 1 |
---
|
| 2 |
title: Next Ask
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Next Ask
|
| 3 |
+
emoji: 🏷️
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
+
app_file: index.html
|
| 8 |
pinned: false
|
| 9 |
+
license: cc-by-4.0
|
| 10 |
+
short_description: Pick the next most valuable label, live in the browser
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Next Ask
|
| 14 |
+
|
| 15 |
+
Next Ask decides **which unlabeled example to send to a person next** when labels are expensive. It ranks the pool by
|
| 16 |
+
classifier uncertainty, shortlists the 40 least certain items, then picks items that are both uncertain and far from
|
| 17 |
+
everything already labeled. A small softmax classifier retrains after each batch.
|
| 18 |
+
|
| 19 |
+
**Model:** https://huggingface.co/thelamapi/Next-Ask — label the digits the selector asks for; the classifier retrains in your browser.
|
| 20 |
+
|
| 21 |
+
## Results (10 seeds, 360 held-out test digits, batches of 10, budget 200)
|
| 22 |
+
|
| 23 |
+
| Strategy | Area under learning curve | Final accuracy | Labels to reach 90% (median) |
|
| 24 |
+
|---|---:|---:|---:|
|
| 25 |
+
| Uncertainty + diversity (Next Ask) | 0.8897 ± 0.0066 | 0.9583 | 70 (10/10 seeds) |
|
| 26 |
+
| Uncertainty only | 0.8837 ± 0.0135 | 0.9569 | 70 (10/10 seeds) |
|
| 27 |
+
| Random | 0.8508 ± 0.0115 | 0.9283 | 115 (10/10 seeds) |
|
| 28 |
+
|
| 29 |
+
Mean test accuracy at selected label counts:
|
| 30 |
+
|
| 31 |
+
| Labels | Random | Uncertainty | Uncertainty + diversity |
|
| 32 |
+
|---:|---:|---:|---:|
|
| 33 |
+
| 20 | 0.6508 | 0.6608 | 0.7036 |
|
| 34 |
+
| 50 | 0.8386 | 0.8650 | 0.8736 |
|
| 35 |
+
| 100 | 0.8864 | 0.9294 | 0.9314 |
|
| 36 |
+
| 150 | 0.9131 | 0.9447 | 0.9492 |
|
| 37 |
+
| 200 | 0.9283 | 0.9569 | 0.9583 |
|
| 38 |
+
|
| 39 |
+
Paired by seed (same initial labels): hybrid − random AULC = +0.0388 ± 0.0113
|
| 40 |
+
(hybrid better in 10/10 seeds); hybrid − uncertainty = +0.0060 ± 0.0104
|
| 41 |
+
(6/10 seeds).
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
|
| 45 |
+
## Method
|
| 46 |
+
* Classifier: multinomial logistic regression on the 64 pixel intensities, full-batch gradient descent from zero weights
|
| 47 |
+
(steps=150, lr=1.0, l2=0.001, chosen on a 200-example validation split, never on test).
|
| 48 |
+
* Uncertainty: margin between the two most probable classes.
|
| 49 |
+
* Diversity: farthest-first selection on the uncertain shortlist, score = (1 − margin) × distance to the nearest labeled or already chosen example.
|
| 50 |
+
* The browser runs a line-by-line JavaScript port. Node parity on 4 fixed cases: max abs difference 1.1102230246251565e-16.
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
```python
|
| 54 |
+
from inference import load, predict, next_queries
|
| 55 |
+
spec = load() # model.json, NumPy only
|
| 56 |
+
probs = predict(spec, pixels) # pixels: (N, 64) ints 0..16
|
| 57 |
+
picks = next_queries(spec, pool_pixels, labeled_idx, labels, strategy="hybrid", batch=5)
|
| 58 |
+
```
|
| 59 |
+
`python inference.py --selftest` reloads the model and checks stored outputs.
|
| 60 |
+
|
| 61 |
+
## Data
|
| 62 |
+
Optical Recognition of Handwritten Digits (8x8) — UCI ML Repository id 80 via sklearn.datasets.load_digits, license CC BY 4.0. Split: 1237 pool /
|
| 63 |
+
200 validation / 360 test, stratified, seed 73.
|
| 64 |
+
|
| 65 |
+
## Limitations
|
| 66 |
+
* 8×8 digits are an easy, balanced benchmark; gains from active learning are usually smaller on noisy, imbalanced real data.
|
| 67 |
+
* The simulation assumes a perfect annotator (dataset labels). The Space lets people label, but no human study was run.
|
| 68 |
+
* Final model in `model.json` is the seed-0 hybrid run at the full budget, kept for demonstration (17 of 360 test digits wrong).
|
| 69 |
+
* Hardware for the recorded run: NVIDIA L4. Profile: full.
|
| 70 |
+
|
| 71 |
+
Files: `model.json` (weights), `ask_core.py` (selectors and training), `inference.py`, `nlrt.py`, `config.json`, `evaluation.json` (all numbers, seeds, failures, tests).
|
app.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Next Ask Space: the user labels the digits the selector asks for; the model retrains in the browser. */
|
| 2 |
+
const { $, h, fmt, grayImage, lineChart, legend } = NLUI;
|
| 3 |
+
const COLORS = { random: "#8a8f98", uncertainty: "#2f5fb3", hybrid: "#0b6e4f", you: "#c0392b" };
|
| 4 |
+
const B = 5;
|
| 5 |
+
let ctx, curves, S;
|
| 6 |
+
|
| 7 |
+
function reset() {
|
| 8 |
+
const strategy = $("strategy").value;
|
| 9 |
+
const labeled = curves.initial.slice();
|
| 10 |
+
S = { strategy, labeled, labels: labeled.map(i => ctx.poolY[i]), queue: [], answers: {}, history: [], round: 0 };
|
| 11 |
+
retrain();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
function retrain() {
|
| 15 |
+
S.W = Core.fit(ctx, S.labeled, S.labels);
|
| 16 |
+
S.acc = Core.accuracy(ctx, S.W);
|
| 17 |
+
S.history.push([S.labeled.length, S.acc]);
|
| 18 |
+
S.queue = Core.select(ctx, S.strategy, S.W, S.labeled, B, 9000 + S.round++);
|
| 19 |
+
S.answers = {};
|
| 20 |
+
render();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
function answer(idx, label) {
|
| 24 |
+
S.answers[idx] = label;
|
| 25 |
+
renderQueue();
|
| 26 |
+
if (S.queue.every(i => S.answers[i] != null)) {
|
| 27 |
+
for (const i of S.queue) { S.labeled.push(i); S.labels.push(S.answers[i]); }
|
| 28 |
+
retrain();
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
function renderQueue() {
|
| 33 |
+
const box = $("queue"); box.innerHTML = "";
|
| 34 |
+
for (const i of S.queue) {
|
| 35 |
+
const p = Core.proba(S.W, ctx.pool[i]);
|
| 36 |
+
const guess = NLRT.argmax(p), m = Core.margin(p);
|
| 37 |
+
const c = h("canvas", { width: 64, height: 64, "aria-label": "digit to label" });
|
| 38 |
+
grayImage(c, ctx.poolPixels[i], 8, 8, 8, { lo: 0, hi: 16 });
|
| 39 |
+
const btns = h("div", { class: "chips", style: "margin-top:6px" });
|
| 40 |
+
for (let k = 0; k < 10; k++) {
|
| 41 |
+
const b = h("button", { class: "chip" + (S.answers[i] === k ? " on" : ""), "data-item": i, "data-label": k,
|
| 42 |
+
onclick: () => answer(i, k) }, String(k));
|
| 43 |
+
btns.append(b);
|
| 44 |
+
}
|
| 45 |
+
const hint = $("hint").checked ? ` · dataset label ${ctx.poolY[i]}` : "";
|
| 46 |
+
box.append(h("div", { class: "card", style: "padding:8px" }, c,
|
| 47 |
+
h("div", { class: "small muted" }, `model guesses ${guess} (margin ${fmt(m, 2)})${hint}`), btns));
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function render() {
|
| 52 |
+
$("acc").textContent = fmt(100 * S.acc, 1) + "%";
|
| 53 |
+
$("nlab").textContent = S.labeled.length;
|
| 54 |
+
$("round").textContent = S.history.length - 1;
|
| 55 |
+
renderQueue();
|
| 56 |
+
const series = ["random", "uncertainty", "hybrid"].map(k => ({
|
| 57 |
+
name: `${k} (simulated mean, ${curves.seeds} seeds)`, color: COLORS[k], dash: [5, 4], width: 1.5,
|
| 58 |
+
points: curves.mean[k].map((v, j) => [curves.n[j], v]) }));
|
| 59 |
+
series.push({ name: `your session (${S.strategy})`, color: COLORS.you, width: 2.5, points: S.history });
|
| 60 |
+
lineChart($("chart"), series, { xlabel: "labeled examples", ymin: 0.3, ymax: 1 });
|
| 61 |
+
legend($("legend"), series);
|
| 62 |
+
$("status").textContent = `Strategy: ${S.strategy}. Label the ${B} digits above; the classifier retrains in your browser after each batch.`;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
function autoLabel() { for (const i of S.queue.slice()) if (S.answers[i] == null) answer(i, ctx.poolY[i]); }
|
| 66 |
+
|
| 67 |
+
window.__liveTest = function () {
|
| 68 |
+
$("strategy").value = "hybrid"; reset();
|
| 69 |
+
const acc0 = S.acc, n0 = S.labeled.length, seen = new Set(S.labeled);
|
| 70 |
+
let fresh = true;
|
| 71 |
+
for (let r = 0; r < 3; r++) {
|
| 72 |
+
for (const i of S.queue.slice()) {
|
| 73 |
+
if (seen.has(i)) fresh = false;
|
| 74 |
+
seen.add(i);
|
| 75 |
+
const btn = document.querySelector(`button[data-item="${i}"][data-label="${ctx.poolY[i]}"]`);
|
| 76 |
+
btn.click();
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
return { ok: S.labeled.length === n0 + 3 * B && S.history.length === 4 && fresh && S.queue.length === B,
|
| 80 |
+
acc_before: acc0, acc_after: S.acc, labeled: S.labeled.length };
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
NLUI.boot(Core, async (c) => {
|
| 84 |
+
ctx = c;
|
| 85 |
+
curves = await (await fetch("curves.json")).json();
|
| 86 |
+
$("strategy").addEventListener("change", reset);
|
| 87 |
+
$("reset").addEventListener("click", reset);
|
| 88 |
+
$("auto").addEventListener("click", autoLabel);
|
| 89 |
+
$("hint").addEventListener("change", renderQueue);
|
| 90 |
+
window.addEventListener("resize", () => S && render());
|
| 91 |
+
reset();
|
| 92 |
+
});
|
core.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Next Ask compute core: a line-by-line port of ask_core.py (no DOM). */
|
| 2 |
+
(function (root, factory) {
|
| 3 |
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
| 4 |
+
else root.Core = factory();
|
| 5 |
+
})(typeof self !== "undefined" ? self : this, function () {
|
| 6 |
+
"use strict";
|
| 7 |
+
const ASSETS = ["model.json", "digits.json"];
|
| 8 |
+
|
| 9 |
+
function feats(pixels) { // pixels: array of 64 ints
|
| 10 |
+
const x = new Float64Array(65);
|
| 11 |
+
for (let i = 0; i < 64; i++) x[i] = pixels[i] / 16;
|
| 12 |
+
x[64] = 1; return x;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
function init(assets) {
|
| 16 |
+
const d = assets["digits.json"], m = NLRT.decode(assets["model.json"]);
|
| 17 |
+
return {
|
| 18 |
+
hyper: m.meta.hyper, classes: 10,
|
| 19 |
+
pool: d.pool_pixels.map(feats), poolPixels: d.pool_pixels, poolY: d.pool_y,
|
| 20 |
+
test: d.test_pixels.map(feats), testY: d.test_y,
|
| 21 |
+
W0: m.tensors.W,
|
| 22 |
+
};
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
function train(X, y, hyper) {
|
| 26 |
+
const n = X.length, d = 65, C = 10, { steps, lr, l2 } = hyper;
|
| 27 |
+
const W = new Float64Array(d * C), P = new Float64Array(n * C), G = new Float64Array(d * C);
|
| 28 |
+
for (let s = 0; s < steps; s++) {
|
| 29 |
+
for (let i = 0; i < n; i++) {
|
| 30 |
+
let mx = -Infinity;
|
| 31 |
+
for (let c = 0; c < C; c++) {
|
| 32 |
+
let z = 0; for (let k = 0; k < d; k++) z += X[i][k] * W[k * C + c];
|
| 33 |
+
P[i * C + c] = z; if (z > mx) mx = z;
|
| 34 |
+
}
|
| 35 |
+
let sum = 0;
|
| 36 |
+
for (let c = 0; c < C; c++) { const e = Math.exp(P[i * C + c] - mx); P[i * C + c] = e; sum += e; }
|
| 37 |
+
for (let c = 0; c < C; c++) P[i * C + c] /= sum;
|
| 38 |
+
P[i * C + y[i]] -= 1;
|
| 39 |
+
}
|
| 40 |
+
G.fill(0);
|
| 41 |
+
for (let i = 0; i < n; i++) for (let k = 0; k < d; k++) {
|
| 42 |
+
const xv = X[i][k]; if (xv === 0) continue;
|
| 43 |
+
for (let c = 0; c < C; c++) G[k * C + c] += xv * P[i * C + c];
|
| 44 |
+
}
|
| 45 |
+
for (let k = 0; k < d; k++) for (let c = 0; c < C; c++) {
|
| 46 |
+
const reg = k === d - 1 ? 0 : l2;
|
| 47 |
+
W[k * C + c] -= lr * (G[k * C + c] / n + reg * W[k * C + c]);
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
return W;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
function proba(W, x) {
|
| 54 |
+
const C = 10, z = new Float64Array(C); let mx = -Infinity;
|
| 55 |
+
for (let c = 0; c < C; c++) { let s = 0; for (let k = 0; k < 65; k++) s += x[k] * W[k * C + c]; z[c] = s; if (s > mx) mx = s; }
|
| 56 |
+
let sum = 0; for (let c = 0; c < C; c++) { z[c] = Math.exp(z[c] - mx); sum += z[c]; }
|
| 57 |
+
for (let c = 0; c < C; c++) z[c] /= sum; return z;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
function margin(p) {
|
| 61 |
+
let a = -1, b = -1; for (const v of p) { if (v > a) { b = a; a = v; } else if (v > b) b = v; }
|
| 62 |
+
return a - b;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
function accuracy(ctx, W) {
|
| 66 |
+
let ok = 0;
|
| 67 |
+
ctx.test.forEach((x, i) => { if (NLRT.argmax(proba(W, x)) === ctx.testY[i]) ok++; });
|
| 68 |
+
return ok / ctx.test.length;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
function select(ctx, strategy, W, labeled, B, seed) {
|
| 72 |
+
const X = ctx.pool, L = new Set(labeled), unl = [];
|
| 73 |
+
for (let i = 0; i < X.length; i++) if (!L.has(i)) unl.push(i);
|
| 74 |
+
if (strategy === "random") {
|
| 75 |
+
const rng = NLRT.mulberry32(seed), arr = unl.slice(), picks = [];
|
| 76 |
+
for (let k = 0; k < Math.min(B, arr.length); k++) {
|
| 77 |
+
const j = k + rng.randint(arr.length - k);
|
| 78 |
+
[arr[k], arr[j]] = [arr[j], arr[k]]; picks.push(arr[k]);
|
| 79 |
+
}
|
| 80 |
+
return picks;
|
| 81 |
+
}
|
| 82 |
+
const m = unl.map(i => margin(proba(W, X[i])));
|
| 83 |
+
const order = unl.map((_, k) => k).sort((a, b) => (m[a] - m[b]) || (unl[a] - unl[b]));
|
| 84 |
+
if (strategy === "uncertainty") return order.slice(0, B).map(k => unl[k]);
|
| 85 |
+
const short = order.slice(0, 4 * B);
|
| 86 |
+
const anchors = Array.from(L).sort((a, b) => a - b);
|
| 87 |
+
const dist = (p, q) => { let s = 0; for (let k = 0; k < 64; k++) { const t = p[k] - q[k]; s += t * t; } return Math.sqrt(s); };
|
| 88 |
+
const dmin = short.map(k => { let best = Infinity; for (const a of anchors) best = Math.min(best, dist(X[unl[k]], X[a])); return best; });
|
| 89 |
+
const used = short.map(() => false), picks = [];
|
| 90 |
+
for (let r = 0; r < Math.min(B, short.length); r++) {
|
| 91 |
+
let bk = -1, bs = -Infinity;
|
| 92 |
+
for (let j = 0; j < short.length; j++) {
|
| 93 |
+
if (used[j]) continue;
|
| 94 |
+
const s = (1 - m[short[j]]) * dmin[j];
|
| 95 |
+
if (s > bs) { bs = s; bk = j; }
|
| 96 |
+
}
|
| 97 |
+
used[bk] = true; picks.push(unl[short[bk]]);
|
| 98 |
+
for (let j = 0; j < short.length; j++) dmin[j] = Math.min(dmin[j], dist(X[unl[short[j]]], X[unl[short[bk]]]));
|
| 99 |
+
}
|
| 100 |
+
return picks;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
function fit(ctx, labeled, labels) {
|
| 104 |
+
return train(labeled.map(i => ctx.pool[i]), labels, ctx.hyper);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// Parity entry point: same inputs as the Python-generated cases.
|
| 108 |
+
function runCase(ctx, input) {
|
| 109 |
+
const W = fit(ctx, input.labeled, input.labels);
|
| 110 |
+
const picks = select(ctx, input.strategy, W, input.labeled, input.B, input.seed);
|
| 111 |
+
return { accuracy: accuracy(ctx, W), picks, proba_test0: Array.from(proba(W, ctx.test[0])) };
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
return { ASSETS, init, train, fit, proba, margin, accuracy, select, runCase };
|
| 115 |
+
});
|
curves.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"n": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200], "seeds": 10, "initial": [775, 4, 653, 1213, 1198, 351, 760, 893, 531, 1230], "mean": {"random": [0.4972222222222221, 0.6508333333333334, 0.7319444444444445, 0.8058333333333334, 0.8386111111111111, 0.8577777777777778, 0.875, 0.8733333333333334, 0.8822222222222222, 0.8863888888888889, 0.891388888888889, 0.8952777777777777, 0.9038888888888887, 0.9038888888888892, 0.9130555555555556, 0.9152777777777779, 0.9175000000000001, 0.9233333333333335, 0.9252777777777779, 0.9283333333333335], "uncertainty": [0.4972222222222221, 0.6608333333333334, 0.7691666666666667, 0.836111111111111, 0.865, 0.8869444444444443, 0.9080555555555556, 0.9172222222222223, 0.9241666666666666, 0.9294444444444444, 0.9358333333333333, 0.9411111111111111, 0.9413888888888889, 0.943611111111111, 0.9447222222222222, 0.9497222222222221, 0.9533333333333334, 0.9541666666666666, 0.9588888888888889, 0.9569444444444445], "hybrid": [0.4972222222222221, 0.7036111111111111, 0.7972222222222223, 0.8483333333333333, 0.8736111111111111, 0.8933333333333333, 0.9052777777777778, 0.9175000000000001, 0.9244444444444445, 0.931388888888889, 0.9349999999999999, 0.9375, 0.9422222222222221, 0.9480555555555554, 0.9491666666666665, 0.9533333333333334, 0.9574999999999999, 0.9605555555555554, 0.9594444444444443, 0.9583333333333333]}}
|
digits.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
evaluation.json
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project": "Next Ask",
|
| 3 |
+
"profile": "full",
|
| 4 |
+
"seed": 73,
|
| 5 |
+
"device": {
|
| 6 |
+
"python": "3.13.16",
|
| 7 |
+
"platform": "Linux-6.6.159+-x86_64-with-glibc2.39",
|
| 8 |
+
"cpu_count": 12,
|
| 9 |
+
"numpy": "2.4.6",
|
| 10 |
+
"torch": "2.14.1+cu130",
|
| 11 |
+
"cuda": true,
|
| 12 |
+
"gpu": "NVIDIA L4",
|
| 13 |
+
"colab": true
|
| 14 |
+
},
|
| 15 |
+
"data": {
|
| 16 |
+
"name": "Optical Recognition of Handwritten Digits (8x8)",
|
| 17 |
+
"source": "UCI ML Repository id 80 via sklearn.datasets.load_digits",
|
| 18 |
+
"license": "CC BY 4.0",
|
| 19 |
+
"sklearn_version": "1.6.1",
|
| 20 |
+
"n_total": 1797,
|
| 21 |
+
"split": {
|
| 22 |
+
"pool": 1237,
|
| 23 |
+
"validation": 200,
|
| 24 |
+
"test": 360,
|
| 25 |
+
"method": "stratified train_test_split, random_state=73; test only for final reporting"
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"classifier": {
|
| 29 |
+
"type": "multinomial logistic regression, full-batch GD from zeros",
|
| 30 |
+
"hyper": {
|
| 31 |
+
"steps": 150,
|
| 32 |
+
"lr": 1.0,
|
| 33 |
+
"l2": 0.001
|
| 34 |
+
},
|
| 35 |
+
"hyper_selection": {
|
| 36 |
+
"split": "validation",
|
| 37 |
+
"grid": [
|
| 38 |
+
{
|
| 39 |
+
"hyper": {
|
| 40 |
+
"steps": 100,
|
| 41 |
+
"lr": 0.5,
|
| 42 |
+
"l2": 0.001
|
| 43 |
+
},
|
| 44 |
+
"val_accuracy": 0.7816666666666666
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"hyper": {
|
| 48 |
+
"steps": 100,
|
| 49 |
+
"lr": 0.5,
|
| 50 |
+
"l2": 0.01
|
| 51 |
+
},
|
| 52 |
+
"val_accuracy": 0.775
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"hyper": {
|
| 56 |
+
"steps": 100,
|
| 57 |
+
"lr": 1.0,
|
| 58 |
+
"l2": 0.001
|
| 59 |
+
},
|
| 60 |
+
"val_accuracy": 0.7966666666666667
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"hyper": {
|
| 64 |
+
"steps": 100,
|
| 65 |
+
"lr": 1.0,
|
| 66 |
+
"l2": 0.01
|
| 67 |
+
},
|
| 68 |
+
"val_accuracy": 0.79
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"hyper": {
|
| 72 |
+
"steps": 150,
|
| 73 |
+
"lr": 0.5,
|
| 74 |
+
"l2": 0.001
|
| 75 |
+
},
|
| 76 |
+
"val_accuracy": 0.7949999999999999
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"hyper": {
|
| 80 |
+
"steps": 150,
|
| 81 |
+
"lr": 0.5,
|
| 82 |
+
"l2": 0.01
|
| 83 |
+
},
|
| 84 |
+
"val_accuracy": 0.7833333333333333
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"hyper": {
|
| 88 |
+
"steps": 150,
|
| 89 |
+
"lr": 1.0,
|
| 90 |
+
"l2": 0.001
|
| 91 |
+
},
|
| 92 |
+
"val_accuracy": 0.8083333333333335
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"hyper": {
|
| 96 |
+
"steps": 150,
|
| 97 |
+
"lr": 1.0,
|
| 98 |
+
"l2": 0.01
|
| 99 |
+
},
|
| 100 |
+
"val_accuracy": 0.7949999999999999
|
| 101 |
+
}
|
| 102 |
+
]
|
| 103 |
+
}
|
| 104 |
+
},
|
| 105 |
+
"protocol": {
|
| 106 |
+
"seeds": [
|
| 107 |
+
0,
|
| 108 |
+
1,
|
| 109 |
+
2,
|
| 110 |
+
3,
|
| 111 |
+
4,
|
| 112 |
+
5,
|
| 113 |
+
6,
|
| 114 |
+
7,
|
| 115 |
+
8,
|
| 116 |
+
9
|
| 117 |
+
],
|
| 118 |
+
"initial_labels": 10,
|
| 119 |
+
"batch": 10,
|
| 120 |
+
"budget": 200,
|
| 121 |
+
"pairing": "all strategies share the same initial labeled set per seed"
|
| 122 |
+
},
|
| 123 |
+
"label_axis": [
|
| 124 |
+
10,
|
| 125 |
+
20,
|
| 126 |
+
30,
|
| 127 |
+
40,
|
| 128 |
+
50,
|
| 129 |
+
60,
|
| 130 |
+
70,
|
| 131 |
+
80,
|
| 132 |
+
90,
|
| 133 |
+
100,
|
| 134 |
+
110,
|
| 135 |
+
120,
|
| 136 |
+
130,
|
| 137 |
+
140,
|
| 138 |
+
150,
|
| 139 |
+
160,
|
| 140 |
+
170,
|
| 141 |
+
180,
|
| 142 |
+
190,
|
| 143 |
+
200
|
| 144 |
+
],
|
| 145 |
+
"results": {
|
| 146 |
+
"random": {
|
| 147 |
+
"mean_curve": [
|
| 148 |
+
0.4972222222222221,
|
| 149 |
+
0.6508333333333334,
|
| 150 |
+
0.7319444444444445,
|
| 151 |
+
0.8058333333333334,
|
| 152 |
+
0.8386111111111111,
|
| 153 |
+
0.8577777777777778,
|
| 154 |
+
0.875,
|
| 155 |
+
0.8733333333333334,
|
| 156 |
+
0.8822222222222222,
|
| 157 |
+
0.8863888888888889,
|
| 158 |
+
0.891388888888889,
|
| 159 |
+
0.8952777777777777,
|
| 160 |
+
0.9038888888888887,
|
| 161 |
+
0.9038888888888892,
|
| 162 |
+
0.9130555555555556,
|
| 163 |
+
0.9152777777777779,
|
| 164 |
+
0.9175000000000001,
|
| 165 |
+
0.9233333333333335,
|
| 166 |
+
0.9252777777777779,
|
| 167 |
+
0.9283333333333335
|
| 168 |
+
],
|
| 169 |
+
"std_curve": [
|
| 170 |
+
0.059004080210452226,
|
| 171 |
+
0.06322175844391503,
|
| 172 |
+
0.04262327799642462,
|
| 173 |
+
0.04171201236225172,
|
| 174 |
+
0.03069287326295477,
|
| 175 |
+
0.020927564668708192,
|
| 176 |
+
0.024438130497691987,
|
| 177 |
+
0.025645975305741767,
|
| 178 |
+
0.02351122663277648,
|
| 179 |
+
0.019580870609530135,
|
| 180 |
+
0.01654819000956276,
|
| 181 |
+
0.016622627000419093,
|
| 182 |
+
0.016536528962374692,
|
| 183 |
+
0.015020562038439754,
|
| 184 |
+
0.010974859036188004,
|
| 185 |
+
0.012187450538044603,
|
| 186 |
+
0.015518308581626014,
|
| 187 |
+
0.013217085837078126,
|
| 188 |
+
0.010573814617041271,
|
| 189 |
+
0.009922539499717643
|
| 190 |
+
],
|
| 191 |
+
"aulc_mean": 0.8508194444444446,
|
| 192 |
+
"aulc_std": 0.011463921196411408,
|
| 193 |
+
"final_accuracy_mean": 0.9283333333333335,
|
| 194 |
+
"labels_to_90pct_per_seed": [
|
| 195 |
+
120,
|
| 196 |
+
90,
|
| 197 |
+
130,
|
| 198 |
+
110,
|
| 199 |
+
80,
|
| 200 |
+
100,
|
| 201 |
+
170,
|
| 202 |
+
70,
|
| 203 |
+
130,
|
| 204 |
+
150
|
| 205 |
+
]
|
| 206 |
+
},
|
| 207 |
+
"uncertainty": {
|
| 208 |
+
"mean_curve": [
|
| 209 |
+
0.4972222222222221,
|
| 210 |
+
0.6608333333333334,
|
| 211 |
+
0.7691666666666667,
|
| 212 |
+
0.836111111111111,
|
| 213 |
+
0.865,
|
| 214 |
+
0.8869444444444443,
|
| 215 |
+
0.9080555555555556,
|
| 216 |
+
0.9172222222222223,
|
| 217 |
+
0.9241666666666666,
|
| 218 |
+
0.9294444444444444,
|
| 219 |
+
0.9358333333333333,
|
| 220 |
+
0.9411111111111111,
|
| 221 |
+
0.9413888888888889,
|
| 222 |
+
0.943611111111111,
|
| 223 |
+
0.9447222222222222,
|
| 224 |
+
0.9497222222222221,
|
| 225 |
+
0.9533333333333334,
|
| 226 |
+
0.9541666666666666,
|
| 227 |
+
0.9588888888888889,
|
| 228 |
+
0.9569444444444445
|
| 229 |
+
],
|
| 230 |
+
"std_curve": [
|
| 231 |
+
0.059004080210452226,
|
| 232 |
+
0.04963524360177361,
|
| 233 |
+
0.06437556184580423,
|
| 234 |
+
0.04897089082453114,
|
| 235 |
+
0.032231799343022866,
|
| 236 |
+
0.02629515516564194,
|
| 237 |
+
0.012695994313362711,
|
| 238 |
+
0.010815512407739881,
|
| 239 |
+
0.01061750825200912,
|
| 240 |
+
0.011466537466972383,
|
| 241 |
+
0.009972957261675673,
|
| 242 |
+
0.007222222222222197,
|
| 243 |
+
0.008093779046851896,
|
| 244 |
+
0.007762882562490039,
|
| 245 |
+
0.010277777777777776,
|
| 246 |
+
0.006854979266251711,
|
| 247 |
+
0.006781419786518746,
|
| 248 |
+
0.006364688465216471,
|
| 249 |
+
0.004937885787397574,
|
| 250 |
+
0.006242279181734529
|
| 251 |
+
],
|
| 252 |
+
"aulc_mean": 0.8836944444444444,
|
| 253 |
+
"aulc_std": 0.013546217184144036,
|
| 254 |
+
"final_accuracy_mean": 0.9569444444444443,
|
| 255 |
+
"labels_to_90pct_per_seed": [
|
| 256 |
+
60,
|
| 257 |
+
70,
|
| 258 |
+
70,
|
| 259 |
+
70,
|
| 260 |
+
60,
|
| 261 |
+
80,
|
| 262 |
+
60,
|
| 263 |
+
80,
|
| 264 |
+
70,
|
| 265 |
+
60
|
| 266 |
+
]
|
| 267 |
+
},
|
| 268 |
+
"hybrid": {
|
| 269 |
+
"mean_curve": [
|
| 270 |
+
0.4972222222222221,
|
| 271 |
+
0.7036111111111111,
|
| 272 |
+
0.7972222222222223,
|
| 273 |
+
0.8483333333333333,
|
| 274 |
+
0.8736111111111111,
|
| 275 |
+
0.8933333333333333,
|
| 276 |
+
0.9052777777777778,
|
| 277 |
+
0.9175000000000001,
|
| 278 |
+
0.9244444444444445,
|
| 279 |
+
0.931388888888889,
|
| 280 |
+
0.9349999999999999,
|
| 281 |
+
0.9375,
|
| 282 |
+
0.9422222222222221,
|
| 283 |
+
0.9480555555555554,
|
| 284 |
+
0.9491666666666665,
|
| 285 |
+
0.9533333333333334,
|
| 286 |
+
0.9574999999999999,
|
| 287 |
+
0.9605555555555554,
|
| 288 |
+
0.9594444444444443,
|
| 289 |
+
0.9583333333333333
|
| 290 |
+
],
|
| 291 |
+
"std_curve": [
|
| 292 |
+
0.059004080210452226,
|
| 293 |
+
0.04441057737427031,
|
| 294 |
+
0.027943947422131746,
|
| 295 |
+
0.03218388523991164,
|
| 296 |
+
0.011197580205970207,
|
| 297 |
+
0.006712803318663668,
|
| 298 |
+
0.012877029984999185,
|
| 299 |
+
0.013031893450822117,
|
| 300 |
+
0.007535922203472533,
|
| 301 |
+
0.008962369891612037,
|
| 302 |
+
0.009312808119022332,
|
| 303 |
+
0.011266277661485132,
|
| 304 |
+
0.009362388636862604,
|
| 305 |
+
0.007458734212276422,
|
| 306 |
+
0.006579288490181691,
|
| 307 |
+
0.006060395619242084,
|
| 308 |
+
0.006579288490181691,
|
| 309 |
+
0.0049378857873975624,
|
| 310 |
+
0.0033333333333333435,
|
| 311 |
+
0.005555555555555575
|
| 312 |
+
],
|
| 313 |
+
"aulc_mean": 0.8896527777777777,
|
| 314 |
+
"aulc_std": 0.0066435507806675955,
|
| 315 |
+
"final_accuracy_mean": 0.9583333333333333,
|
| 316 |
+
"labels_to_90pct_per_seed": [
|
| 317 |
+
60,
|
| 318 |
+
70,
|
| 319 |
+
60,
|
| 320 |
+
70,
|
| 321 |
+
70,
|
| 322 |
+
80,
|
| 323 |
+
80,
|
| 324 |
+
40,
|
| 325 |
+
80,
|
| 326 |
+
80
|
| 327 |
+
]
|
| 328 |
+
}
|
| 329 |
+
},
|
| 330 |
+
"paired_aulc": {
|
| 331 |
+
"hybrid_minus_random": {
|
| 332 |
+
"aulc_diff_mean": 0.038833333333333366,
|
| 333 |
+
"aulc_diff_std": 0.011321139954816477,
|
| 334 |
+
"hybrid_wins": 10,
|
| 335 |
+
"seeds": 10
|
| 336 |
+
},
|
| 337 |
+
"hybrid_minus_uncertainty": {
|
| 338 |
+
"aulc_diff_mean": 0.005958333333333366,
|
| 339 |
+
"aulc_diff_std": 0.010409525329840541,
|
| 340 |
+
"hybrid_wins": 6,
|
| 341 |
+
"seeds": 10
|
| 342 |
+
}
|
| 343 |
+
},
|
| 344 |
+
"failure_examples": {
|
| 345 |
+
"model": "hybrid seed 0 at full budget",
|
| 346 |
+
"n_wrong": 17,
|
| 347 |
+
"first": [
|
| 348 |
+
{
|
| 349 |
+
"test_index": 648,
|
| 350 |
+
"true": 2,
|
| 351 |
+
"predicted": 3,
|
| 352 |
+
"confidence": 0.4906110093411642
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"test_index": 1149,
|
| 356 |
+
"true": 8,
|
| 357 |
+
"predicted": 1,
|
| 358 |
+
"confidence": 0.279524654801159
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
"test_index": 1264,
|
| 362 |
+
"true": 1,
|
| 363 |
+
"predicted": 8,
|
| 364 |
+
"confidence": 0.4017349208333158
|
| 365 |
+
},
|
| 366 |
+
{
|
| 367 |
+
"test_index": 901,
|
| 368 |
+
"true": 9,
|
| 369 |
+
"predicted": 8,
|
| 370 |
+
"confidence": 0.39549887000865813
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"test_index": 1595,
|
| 374 |
+
"true": 7,
|
| 375 |
+
"predicted": 4,
|
| 376 |
+
"confidence": 0.3269425499797302
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"test_index": 498,
|
| 380 |
+
"true": 7,
|
| 381 |
+
"predicted": 9,
|
| 382 |
+
"confidence": 0.3155363201045011
|
| 383 |
+
},
|
| 384 |
+
{
|
| 385 |
+
"test_index": 492,
|
| 386 |
+
"true": 6,
|
| 387 |
+
"predicted": 8,
|
| 388 |
+
"confidence": 0.4289399503435557
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"test_index": 746,
|
| 392 |
+
"true": 4,
|
| 393 |
+
"predicted": 7,
|
| 394 |
+
"confidence": 0.513914544250967
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"test_index": 447,
|
| 398 |
+
"true": 7,
|
| 399 |
+
"predicted": 5,
|
| 400 |
+
"confidence": 0.4440512466278117
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"test_index": 457,
|
| 404 |
+
"true": 5,
|
| 405 |
+
"predicted": 9,
|
| 406 |
+
"confidence": 0.5211896895367181
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"test_index": 905,
|
| 410 |
+
"true": 8,
|
| 411 |
+
"predicted": 1,
|
| 412 |
+
"confidence": 0.5462623831942506
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"test_index": 1095,
|
| 416 |
+
"true": 4,
|
| 417 |
+
"predicted": 9,
|
| 418 |
+
"confidence": 0.38364309630663607
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"test_index": 857,
|
| 422 |
+
"true": 7,
|
| 423 |
+
"predicted": 3,
|
| 424 |
+
"confidence": 0.5475465941519988
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"test_index": 719,
|
| 428 |
+
"true": 9,
|
| 429 |
+
"predicted": 1,
|
| 430 |
+
"confidence": 0.5353181203934337
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"test_index": 1384,
|
| 434 |
+
"true": 4,
|
| 435 |
+
"predicted": 6,
|
| 436 |
+
"confidence": 0.4296230000789044
|
| 437 |
+
},
|
| 438 |
+
{
|
| 439 |
+
"test_index": 769,
|
| 440 |
+
"true": 8,
|
| 441 |
+
"predicted": 2,
|
| 442 |
+
"confidence": 0.3883439380665226
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"test_index": 794,
|
| 446 |
+
"true": 8,
|
| 447 |
+
"predicted": 1,
|
| 448 |
+
"confidence": 0.4823884399122324
|
| 449 |
+
}
|
| 450 |
+
]
|
| 451 |
+
},
|
| 452 |
+
"tests": {
|
| 453 |
+
"reload": {
|
| 454 |
+
"returncode": 0,
|
| 455 |
+
"seconds": 0.18,
|
| 456 |
+
"process": "fresh python -E subprocess, cwd = temporary copy of the model folder",
|
| 457 |
+
"passed": true,
|
| 458 |
+
"max_abs_diff": 5.220997367771929e-08,
|
| 459 |
+
"picks": [
|
| 460 |
+
96,
|
| 461 |
+
36,
|
| 462 |
+
26,
|
| 463 |
+
7,
|
| 464 |
+
105
|
| 465 |
+
],
|
| 466 |
+
"expected_picks": [
|
| 467 |
+
96,
|
| 468 |
+
36,
|
| 469 |
+
26,
|
| 470 |
+
7,
|
| 471 |
+
105
|
| 472 |
+
],
|
| 473 |
+
"n_samples": 16
|
| 474 |
+
},
|
| 475 |
+
"node_parity": {
|
| 476 |
+
"cases": 4,
|
| 477 |
+
"failed": 0,
|
| 478 |
+
"maxDiff": 1.1102230246251565e-16,
|
| 479 |
+
"results": [
|
| 480 |
+
{
|
| 481 |
+
"name": "hybrid-10",
|
| 482 |
+
"maxDiff": 1.1102230246251565e-16
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"name": "uncertainty-25",
|
| 486 |
+
"maxDiff": 5.551115123125783e-17
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"name": "random-40",
|
| 490 |
+
"maxDiff": 1.1102230246251565e-16
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"name": "hybrid-60",
|
| 494 |
+
"maxDiff": 4.163336342344337e-17
|
| 495 |
+
}
|
| 496 |
+
],
|
| 497 |
+
"ms": 114,
|
| 498 |
+
"runtime": "node v22.23.4",
|
| 499 |
+
"status": "passed"
|
| 500 |
+
},
|
| 501 |
+
"browser": {
|
| 502 |
+
"status": "skipped",
|
| 503 |
+
"reason": "playwright not installed"
|
| 504 |
+
}
|
| 505 |
+
},
|
| 506 |
+
"not_run": [
|
| 507 |
+
"Human annotation study: the Space accepts user labels, but no user study was run."
|
| 508 |
+
]
|
| 509 |
+
}
|
index.html
CHANGED
|
@@ -1,19 +1,59 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<link rel="icon" href="data:,">
|
| 7 |
+
<title>Next Ask</title>
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<main>
|
| 12 |
+
<header>
|
| 13 |
+
<h1>Next Ask</h1>
|
| 14 |
+
<p>Which example should be labeled next? The selector asks you for labels, then a small classifier retrains in your browser and is scored on 360 held-out digits.</p>
|
| 15 |
+
<div class="badges"><span class="badge">Live in-browser training</span><span class="badge">UCI handwritten digits (CC BY 4.0)</span><a class="badge" href="https://huggingface.co/thelamapi/Next-Ask">Model repo</a></div>
|
| 16 |
+
</header>
|
| 17 |
+
<div class="grid">
|
| 18 |
+
<section class="card">
|
| 19 |
+
<h2>Selector</h2>
|
| 20 |
+
<label for="strategy">Selection strategy</label>
|
| 21 |
+
<select id="strategy">
|
| 22 |
+
<option value="hybrid">Uncertainty + diversity (Next Ask)</option>
|
| 23 |
+
<option value="uncertainty">Uncertainty only</option>
|
| 24 |
+
<option value="random">Random</option>
|
| 25 |
+
</select>
|
| 26 |
+
<div class="row" style="margin-top:10px">
|
| 27 |
+
<button id="reset">Restart from 10 labels</button>
|
| 28 |
+
<button id="auto" class="ghost">Fill batch with dataset labels</button>
|
| 29 |
+
</div>
|
| 30 |
+
<label><input type="checkbox" id="hint"> Show dataset label as a hint</label>
|
| 31 |
+
<div class="kpi" style="margin-top:10px">
|
| 32 |
+
<div><b id="acc">–</b><span>test accuracy</span></div>
|
| 33 |
+
<div><b id="nlab">–</b><span>labels used</span></div>
|
| 34 |
+
<div><b id="round">–</b><span>batches labeled</span></div>
|
| 35 |
+
</div>
|
| 36 |
+
</section>
|
| 37 |
+
<section class="card">
|
| 38 |
+
<h2>Accuracy vs labels</h2>
|
| 39 |
+
<canvas id="chart"></canvas>
|
| 40 |
+
<div id="legend"></div>
|
| 41 |
+
</section>
|
| 42 |
+
</div>
|
| 43 |
+
<section class="card" style="margin-top:12px">
|
| 44 |
+
<h2>Label these digits</h2>
|
| 45 |
+
<p class="status" id="status">Loading…</p>
|
| 46 |
+
<div class="grid" id="queue" style="grid-template-columns:repeat(auto-fit,minmax(150px,1fr))"></div>
|
| 47 |
+
</section>
|
| 48 |
+
<section class="card" style="margin-top:12px">
|
| 49 |
+
<h2>Recorded benchmark</h2>
|
| 50 |
+
<img src="preview.png" alt="Learning curves from the notebook benchmark" style="width:100%;border-radius:8px">
|
| 51 |
+
</section>
|
| 52 |
+
<footer>Wrong labels are allowed: they show how noisy annotation affects the model. Benchmark numbers come from the notebook, not from this page.</footer>
|
| 53 |
+
</main>
|
| 54 |
+
<script src="nlrt.js"></script>
|
| 55 |
+
<script src="nlui.js"></script>
|
| 56 |
+
<script src="core.js"></script>
|
| 57 |
+
<script src="app.js"></script>
|
| 58 |
+
</body>
|
| 59 |
</html>
|
model.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"format":"nlrt-1","meta":{"name":"Next Ask","hyper":{"steps":150,"lr":1.0,"l2":0.001},"classes":[0,1,2,3,4,5,6,7,8,9],"trained_on":"200 pool labels chosen by the hybrid selector (seed 0)"},"nets":{},"tensors":{"W":{"shape":[65,10],"data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKZLEb2iGbC968HNPGL8Xj44/Ee9uFEsPgXsM72a98A7iFKevQeLAL6B7Dk+c9EpvgL3iD6BKTm+D+mXvvNCjz95RRe/Tm9iPhV0+L6cLI+9UP20PpLM6b2OzUw+LzLQPpzKkr/F9oO9yXozvtxkkj60/Mq+Hq0mP3dOcz2hwpu/Mw//vSJklT8JoAO/pguuPuzf7b024ZU+VmwfPvS3ML1P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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* nlrt.js: browser and Node twin of nlrt.py. Batch size 1, float64 math. */
|
| 2 |
+
(function (root, factory) {
|
| 3 |
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
| 4 |
+
else root.NLRT = factory();
|
| 5 |
+
})(typeof self !== "undefined" ? self : this, function () {
|
| 6 |
+
"use strict";
|
| 7 |
+
|
| 8 |
+
function b64d(s) {
|
| 9 |
+
let bin;
|
| 10 |
+
if (typeof atob === "function") bin = atob(s);
|
| 11 |
+
else bin = Buffer.from(s, "base64").toString("binary");
|
| 12 |
+
const bytes = new Uint8Array(bin.length);
|
| 13 |
+
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
| 14 |
+
return new Float32Array(bytes.buffer);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
function decode(spec) {
|
| 18 |
+
for (const name in spec.nets || {}) {
|
| 19 |
+
for (const L of spec.nets[name]) {
|
| 20 |
+
if (typeof L.w === "string") L.w = b64d(L.w);
|
| 21 |
+
if (typeof L.b === "string") L.b = b64d(L.b);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
for (const name in spec.tensors || {}) {
|
| 25 |
+
const t = spec.tensors[name];
|
| 26 |
+
if (typeof t.data === "string") t.data = b64d(t.data);
|
| 27 |
+
}
|
| 28 |
+
return spec;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
async function loadModel(url) {
|
| 32 |
+
const r = await fetch(url);
|
| 33 |
+
if (!r.ok) throw new Error("cannot load " + url);
|
| 34 |
+
return decode(await r.json());
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
function pair(v) { return Array.isArray(v) ? v : [v, v]; }
|
| 38 |
+
|
| 39 |
+
// Tensor: {shape: [D]} or {shape: [C, H, W]} or {shape: [C, L]}, data: Float64Array
|
| 40 |
+
function T(shape, data) {
|
| 41 |
+
const n = shape.reduce((a, b) => a * b, 1);
|
| 42 |
+
return { shape: shape.slice(), data: data || new Float64Array(n) };
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
function as3(x) {
|
| 46 |
+
if (x.shape.length === 2) return { t: T([x.shape[0], 1, x.shape[1]], x.data), sq: true };
|
| 47 |
+
return { t: x, sq: false };
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
function conv2d(x0, L) {
|
| 51 |
+
const { t: x, sq } = as3(x0);
|
| 52 |
+
const [C, H, W] = x.shape;
|
| 53 |
+
const [O, I, KH, KW] = L.w_shape;
|
| 54 |
+
const [sh, sw] = pair(L.stride), [ph, pw] = pair(L.pad);
|
| 55 |
+
const OH = Math.floor((H + 2 * ph - KH) / sh) + 1;
|
| 56 |
+
const OW = Math.floor((W + 2 * pw - KW) / sw) + 1;
|
| 57 |
+
const out = new Float64Array(O * OH * OW);
|
| 58 |
+
const w = L.w, b = L.b, xd = x.data;
|
| 59 |
+
for (let o = 0; o < O; o++) {
|
| 60 |
+
for (let oy = 0; oy < OH; oy++) {
|
| 61 |
+
for (let ox = 0; ox < OW; ox++) {
|
| 62 |
+
let s = b[o];
|
| 63 |
+
for (let c = 0; c < I; c++) {
|
| 64 |
+
for (let ky = 0; ky < KH; ky++) {
|
| 65 |
+
const iy = oy * sh + ky - ph;
|
| 66 |
+
if (iy < 0 || iy >= H) continue;
|
| 67 |
+
const wb = ((o * I + c) * KH + ky) * KW, xb = (c * H + iy) * W;
|
| 68 |
+
for (let kx = 0; kx < KW; kx++) {
|
| 69 |
+
const ix = ox * sw + kx - pw;
|
| 70 |
+
if (ix < 0 || ix >= W) continue;
|
| 71 |
+
s += w[wb + kx] * xd[xb + ix];
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
out[(o * OH + oy) * OW + ox] = s;
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
return sq ? T([O, OW], out) : T([O, OH, OW], out);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
function maxpool(x0, L) {
|
| 83 |
+
const { t: x, sq } = as3(x0);
|
| 84 |
+
const [C, H, W] = x.shape, [kh, kw] = pair(L.k);
|
| 85 |
+
const OH = Math.floor(H / kh), OW = Math.floor(W / kw);
|
| 86 |
+
const out = new Float64Array(C * OH * OW);
|
| 87 |
+
for (let c = 0; c < C; c++)
|
| 88 |
+
for (let oy = 0; oy < OH; oy++)
|
| 89 |
+
for (let ox = 0; ox < OW; ox++) {
|
| 90 |
+
let m = -Infinity;
|
| 91 |
+
for (let i = 0; i < kh; i++)
|
| 92 |
+
for (let j = 0; j < kw; j++) {
|
| 93 |
+
const v = x.data[(c * H + oy * kh + i) * W + ox * kw + j];
|
| 94 |
+
if (v > m) m = v;
|
| 95 |
+
}
|
| 96 |
+
out[(c * OH + oy) * OW + ox] = m;
|
| 97 |
+
}
|
| 98 |
+
return sq ? T([C, OW], out) : T([C, OH, OW], out);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
function linear(x, L) {
|
| 102 |
+
const [O, I] = L.w_shape;
|
| 103 |
+
const out = new Float64Array(O);
|
| 104 |
+
for (let o = 0; o < O; o++) {
|
| 105 |
+
let s = L.b[o];
|
| 106 |
+
const base = o * I;
|
| 107 |
+
for (let i = 0; i < I; i++) s += L.w[base + i] * x.data[i];
|
| 108 |
+
out[o] = s;
|
| 109 |
+
}
|
| 110 |
+
return T([O], out);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
function map(x, f) {
|
| 114 |
+
const d = new Float64Array(x.data.length);
|
| 115 |
+
for (let i = 0; i < d.length; i++) d[i] = f(x.data[i]);
|
| 116 |
+
return T(x.shape, d);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
function forward(layers, x) {
|
| 120 |
+
if (!(x.data instanceof Float64Array)) x = T(x.shape, Float64Array.from(x.data));
|
| 121 |
+
for (const L of layers) {
|
| 122 |
+
switch (L.type) {
|
| 123 |
+
case "linear": x = linear(x, L); break;
|
| 124 |
+
case "conv2d": x = conv2d(x, L); break;
|
| 125 |
+
case "relu": x = map(x, v => (v > 0 ? v : 0)); break;
|
| 126 |
+
case "tanh": x = map(x, Math.tanh); break;
|
| 127 |
+
case "sigmoid": x = map(x, v => 1 / (1 + Math.exp(-v))); break;
|
| 128 |
+
case "maxpool": x = maxpool(x, L); break;
|
| 129 |
+
case "gap": {
|
| 130 |
+
const C = x.shape[0], n = x.data.length / C, d = new Float64Array(C);
|
| 131 |
+
for (let c = 0; c < C; c++) { let s = 0; for (let i = 0; i < n; i++) s += x.data[c * n + i]; d[c] = s / n; }
|
| 132 |
+
x = T([C], d); break;
|
| 133 |
+
}
|
| 134 |
+
case "flatten": x = T([x.data.length], x.data); break;
|
| 135 |
+
case "reshape": x = T(L.shape, x.data); break;
|
| 136 |
+
case "upsample": {
|
| 137 |
+
const s = L.s;
|
| 138 |
+
if (x.shape.length === 3) {
|
| 139 |
+
const [C, H, W] = x.shape, d = new Float64Array(C * H * s * W * s);
|
| 140 |
+
for (let c = 0; c < C; c++)
|
| 141 |
+
for (let y = 0; y < H * s; y++)
|
| 142 |
+
for (let xx = 0; xx < W * s; xx++)
|
| 143 |
+
d[(c * H * s + y) * W * s + xx] = x.data[(c * H + Math.floor(y / s)) * W + Math.floor(xx / s)];
|
| 144 |
+
x = T([C, H * s, W * s], d);
|
| 145 |
+
} else {
|
| 146 |
+
const [C, Ln] = x.shape, d = new Float64Array(C * Ln * s);
|
| 147 |
+
for (let c = 0; c < C; c++) for (let i = 0; i < Ln * s; i++) d[c * Ln * s + i] = x.data[c * Ln + Math.floor(i / s)];
|
| 148 |
+
x = T([C, Ln * s], d);
|
| 149 |
+
}
|
| 150 |
+
break;
|
| 151 |
+
}
|
| 152 |
+
case "l2norm": {
|
| 153 |
+
let s = 0; for (const v of x.data) s += v * v;
|
| 154 |
+
const n = Math.max(Math.sqrt(s), 1e-12);
|
| 155 |
+
x = map(x, v => v / n); break;
|
| 156 |
+
}
|
| 157 |
+
default: throw new Error("unknown layer " + L.type);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
return x;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
function mulberry32(seed) {
|
| 164 |
+
let a = seed >>> 0;
|
| 165 |
+
const random = function () {
|
| 166 |
+
a = (a + 0x6D2B79F5) >>> 0;
|
| 167 |
+
let t = a;
|
| 168 |
+
t = Math.imul(t ^ (t >>> 15), t | 1) >>> 0;
|
| 169 |
+
t = (t ^ ((t + (Math.imul(t ^ (t >>> 7), t | 61) >>> 0)) >>> 0)) >>> 0;
|
| 170 |
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
| 171 |
+
};
|
| 172 |
+
return {
|
| 173 |
+
random,
|
| 174 |
+
uniform: (lo, hi) => lo + (hi - lo) * random(),
|
| 175 |
+
randint: n => Math.floor(random() * n),
|
| 176 |
+
normal: () => { const u = Math.max(random(), 1e-12), v = random(); return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v); },
|
| 177 |
+
};
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
function softmax(arr) {
|
| 181 |
+
let m = -Infinity; for (const v of arr) if (v > m) m = v;
|
| 182 |
+
const e = Array.from(arr, v => Math.exp(v - m)); const s = e.reduce((a, b) => a + b, 0);
|
| 183 |
+
return e.map(v => v / s);
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
function argmax(arr) { let k = 0; for (let i = 1; i < arr.length; i++) if (arr[i] > arr[k]) k = i; return k; }
|
| 187 |
+
|
| 188 |
+
// Deep comparison used by parity tests: numbers within tol, everything else exact.
|
| 189 |
+
function compare(got, want, tol, path, acc) {
|
| 190 |
+
acc = acc || { maxDiff: 0, mismatches: [] };
|
| 191 |
+
path = path || "$";
|
| 192 |
+
if (typeof want === "number") {
|
| 193 |
+
const d = Math.abs(Number(got) - want);
|
| 194 |
+
if (!(d <= tol * Math.max(1, Math.abs(want)))) acc.mismatches.push(path + ": got " + got + " want " + want);
|
| 195 |
+
if (isFinite(d)) acc.maxDiff = Math.max(acc.maxDiff, d);
|
| 196 |
+
} else if (Array.isArray(want)) {
|
| 197 |
+
if (!got || got.length !== want.length) acc.mismatches.push(path + ": length " + (got && got.length) + " vs " + want.length);
|
| 198 |
+
else for (let i = 0; i < want.length; i++) compare(got[i], want[i], tol, path + "[" + i + "]", acc);
|
| 199 |
+
} else if (want && typeof want === "object") {
|
| 200 |
+
for (const k in want) compare(got ? got[k] : undefined, want[k], tol, path + "." + k, acc);
|
| 201 |
+
} else if (got !== want) acc.mismatches.push(path + ": got " + got + " want " + want);
|
| 202 |
+
return acc;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
function runParity(core, ctx, parity) {
|
| 206 |
+
const results = [];
|
| 207 |
+
let maxDiff = 0, failed = 0;
|
| 208 |
+
for (const c of parity.cases) {
|
| 209 |
+
const out = core.runCase(ctx, c.input);
|
| 210 |
+
const r = compare(out, c.expected, c.tol != null ? c.tol : parity.tol);
|
| 211 |
+
maxDiff = Math.max(maxDiff, r.maxDiff);
|
| 212 |
+
if (r.mismatches.length) failed++;
|
| 213 |
+
results.push({ name: c.name, maxDiff: r.maxDiff, mismatches: r.mismatches.slice(0, 5) });
|
| 214 |
+
}
|
| 215 |
+
return { cases: parity.cases.length, failed, maxDiff, results };
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
return { b64d, decode, loadModel, T, forward, mulberry32, softmax, argmax, compare, runParity };
|
| 219 |
+
});
|
nlui.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* nlui.js: small DOM and canvas helpers shared by Next Lab Spaces. */
|
| 2 |
+
(function (root) {
|
| 3 |
+
"use strict";
|
| 4 |
+
const $ = id => document.getElementById(id);
|
| 5 |
+
function h(tag, attrs, ...kids) {
|
| 6 |
+
const e = document.createElement(tag);
|
| 7 |
+
for (const k in attrs || {}) {
|
| 8 |
+
if (k === "class") e.className = attrs[k];
|
| 9 |
+
else if (k.startsWith("on")) e.addEventListener(k.slice(2), attrs[k]);
|
| 10 |
+
else if (k === "html") e.innerHTML = attrs[k];
|
| 11 |
+
else e.setAttribute(k, attrs[k]);
|
| 12 |
+
}
|
| 13 |
+
for (const c of kids.flat()) if (c != null) e.append(c.nodeType ? c : document.createTextNode(String(c)));
|
| 14 |
+
return e;
|
| 15 |
+
}
|
| 16 |
+
const css = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
| 17 |
+
const fmt = (v, d = 3) => (v == null || !isFinite(v) ? "–" : Number(v).toFixed(d));
|
| 18 |
+
|
| 19 |
+
function grayImage(canvas, data, w, h, scale, opts) {
|
| 20 |
+
opts = opts || {};
|
| 21 |
+
canvas.width = w * scale; canvas.height = h * scale;
|
| 22 |
+
const ctx = canvas.getContext("2d");
|
| 23 |
+
const img = ctx.createImageData(w, h);
|
| 24 |
+
let lo = opts.lo != null ? opts.lo : 0, hi = opts.hi != null ? opts.hi : 1;
|
| 25 |
+
for (let i = 0; i < w * h; i++) {
|
| 26 |
+
const v = Math.max(0, Math.min(255, Math.round(255 * (data[i] - lo) / (hi - lo || 1))));
|
| 27 |
+
img.data[4 * i] = img.data[4 * i + 1] = img.data[4 * i + 2] = v; img.data[4 * i + 3] = 255;
|
| 28 |
+
}
|
| 29 |
+
const tmp = document.createElement("canvas"); tmp.width = w; tmp.height = h;
|
| 30 |
+
tmp.getContext("2d").putImageData(img, 0, 0);
|
| 31 |
+
ctx.imageSmoothingEnabled = false;
|
| 32 |
+
ctx.drawImage(tmp, 0, 0, w * scale, h * scale);
|
| 33 |
+
return ctx;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function rgbImage(canvas, data, w, h, scale) { // data: CHW in [0,1]
|
| 37 |
+
canvas.width = w * scale; canvas.height = h * scale;
|
| 38 |
+
const ctx = canvas.getContext("2d");
|
| 39 |
+
const img = ctx.createImageData(w, h), n = w * h;
|
| 40 |
+
for (let i = 0; i < n; i++) {
|
| 41 |
+
for (let c = 0; c < 3; c++) img.data[4 * i + c] = Math.max(0, Math.min(255, Math.round(255 * data[c * n + i])));
|
| 42 |
+
img.data[4 * i + 3] = 255;
|
| 43 |
+
}
|
| 44 |
+
const tmp = document.createElement("canvas"); tmp.width = w; tmp.height = h;
|
| 45 |
+
tmp.getContext("2d").putImageData(img, 0, 0);
|
| 46 |
+
ctx.imageSmoothingEnabled = false;
|
| 47 |
+
ctx.drawImage(tmp, 0, 0, w * scale, h * scale);
|
| 48 |
+
return ctx;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// series: [{name, color, points: [[x,y],...], dash}]
|
| 52 |
+
function lineChart(canvas, series, opts) {
|
| 53 |
+
opts = opts || {};
|
| 54 |
+
const W = canvas.clientWidth || 600, H = opts.height || 240, dpr = window.devicePixelRatio || 1;
|
| 55 |
+
canvas.width = W * dpr; canvas.height = H * dpr; canvas.style.height = H + "px";
|
| 56 |
+
const ctx = canvas.getContext("2d"); ctx.scale(dpr, dpr);
|
| 57 |
+
const m = { l: 46, r: 10, t: 10, b: 34 };
|
| 58 |
+
let xs = [], ys = [];
|
| 59 |
+
for (const s of series) for (const [x, y] of s.points) { if (isFinite(y)) { xs.push(x); ys.push(y); } }
|
| 60 |
+
if (opts.hlines) for (const hl of opts.hlines) ys.push(hl.y);
|
| 61 |
+
let x0 = opts.xmin != null ? opts.xmin : Math.min(...xs), x1 = opts.xmax != null ? opts.xmax : Math.max(...xs);
|
| 62 |
+
let y0 = opts.ymin != null ? opts.ymin : Math.min(...ys), y1 = opts.ymax != null ? opts.ymax : Math.max(...ys);
|
| 63 |
+
if (y1 - y0 < 1e-9) { y0 -= 1; y1 += 1; }
|
| 64 |
+
if (x1 - x0 < 1e-9) x1 = x0 + 1;
|
| 65 |
+
const X = x => m.l + (x - x0) / (x1 - x0) * (W - m.l - m.r);
|
| 66 |
+
const Y = y => H - m.b - (y - y0) / (y1 - y0) * (H - m.t - m.b);
|
| 67 |
+
ctx.font = "11px system-ui"; ctx.fillStyle = css("--muted"); ctx.strokeStyle = css("--line"); ctx.lineWidth = 1;
|
| 68 |
+
for (let i = 0; i <= 4; i++) {
|
| 69 |
+
const y = y0 + (y1 - y0) * i / 4;
|
| 70 |
+
ctx.beginPath(); ctx.moveTo(m.l, Y(y)); ctx.lineTo(W - m.r, Y(y)); ctx.stroke();
|
| 71 |
+
ctx.fillText(Math.abs(y) >= 100 ? y.toFixed(0) : y.toFixed(2), 4, Y(y) + 4);
|
| 72 |
+
}
|
| 73 |
+
for (let i = 0; i <= 4; i++) {
|
| 74 |
+
const x = x0 + (x1 - x0) * i / 4;
|
| 75 |
+
ctx.fillText(Math.abs(x) >= 100 || Number.isInteger(x) ? x.toFixed(0) : x.toFixed(1), X(x) - 8, H - m.b + 14);
|
| 76 |
+
}
|
| 77 |
+
if (opts.xlabel) ctx.fillText(opts.xlabel, W / 2 - 30, H - 4);
|
| 78 |
+
if (opts.hlines) for (const hl of opts.hlines) {
|
| 79 |
+
ctx.setLineDash([4, 4]); ctx.strokeStyle = hl.color || css("--muted");
|
| 80 |
+
ctx.beginPath(); ctx.moveTo(m.l, Y(hl.y)); ctx.lineTo(W - m.r, Y(hl.y)); ctx.stroke(); ctx.setLineDash([]);
|
| 81 |
+
}
|
| 82 |
+
for (const s of series) {
|
| 83 |
+
ctx.strokeStyle = s.color; ctx.lineWidth = s.width || 2; ctx.setLineDash(s.dash || []);
|
| 84 |
+
ctx.beginPath(); let first = true;
|
| 85 |
+
for (const [x, y] of s.points) { if (!isFinite(y)) continue; if (first) ctx.moveTo(X(x), Y(y)); else ctx.lineTo(X(x), Y(y)); first = false; }
|
| 86 |
+
ctx.stroke(); ctx.setLineDash([]);
|
| 87 |
+
}
|
| 88 |
+
return { X, Y, ctx };
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
function legend(el, series) {
|
| 92 |
+
el.innerHTML = "";
|
| 93 |
+
for (const s of series) el.append(h("span", { class: "small", style: "margin-right:12px;white-space:nowrap" },
|
| 94 |
+
h("span", { style: `display:inline-block;width:14px;height:3px;background:${s.color};vertical-align:middle;margin-right:4px` }), s.name));
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
async function loadAssets(core) {
|
| 98 |
+
const assets = {};
|
| 99 |
+
for (const name of core.ASSETS) {
|
| 100 |
+
const r = await fetch(name);
|
| 101 |
+
if (!r.ok) throw new Error("cannot load " + name);
|
| 102 |
+
assets[name] = await r.json();
|
| 103 |
+
}
|
| 104 |
+
return assets;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// Standard bootstrap: load assets, init core, expose __parity for automated tests.
|
| 108 |
+
async function boot(core, start) {
|
| 109 |
+
try {
|
| 110 |
+
const assets = await loadAssets(core);
|
| 111 |
+
const ctx = core.init(assets);
|
| 112 |
+
const parity = await (await fetch("parity_cases.json")).json();
|
| 113 |
+
root.__parity = () => NLRT.runParity(core, ctx, parity);
|
| 114 |
+
await start(ctx, assets);
|
| 115 |
+
root.__ready = true;
|
| 116 |
+
} catch (e) {
|
| 117 |
+
console.error(e); root.__error = String(e && e.stack || e);
|
| 118 |
+
const s = document.getElementById("status"); if (s) s.textContent = "Failed to start: " + e;
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
root.NLUI = { $, h, css, fmt, grayImage, rgbImage, lineChart, legend, boot };
|
| 123 |
+
})(typeof self !== "undefined" ? self : this);
|
parity_cases.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"tol": 1e-06, "cases": [{"name": "hybrid-10", "input": {"labeled": [272, 192, 1151, 1096, 822, 253, 1019, 355, 643, 220], "labels": [0, 6, 4, 1, 9, 2, 7, 8, 4, 5], "strategy": "hybrid", "B": 5, "seed": 77}, "expected": {"accuracy": 0.5416666666666666, "picks": [1156, 30, 1012, 303, 1077], "proba_test0": [0.09250207541715132, 0.008082430744328985, 0.002527270161838731, 0.0008980061894130691, 0.0006271428772442243, 0.008079208217013755, 0.014556720535179318, 0.015302261230083518, 0.012871262719285962, 0.8445536219084611]}}, {"name": "uncertainty-25", "input": {"labeled": [919, 1060, 810, 557, 628, 1143, 791, 510, 1078, 96, 476, 589, 1062, 365, 424, 708, 391, 189, 774, 712, 1013, 134, 1016, 564, 846], "labels": [4, 8, 5, 1, 5, 0, 6, 5, 9, 5, 5, 7, 3, 3, 3, 3, 3, 3, 4, 2, 3, 9, 0, 2, 4], "strategy": "uncertainty", "B": 5, "seed": 78}, "expected": {"accuracy": 0.675, "picks": [181, 525, 1203, 700, 426], "proba_test0": [0.01471742485046863, 0.0012823533960554436, 0.0058836236194598455, 0.0907740150533486, 0.010221673748660317, 0.020960076623092325, 0.003734993544501654, 0.004182299753962771, 0.007858641030385945, 0.8403848983800645]}}, {"name": "random-40", "input": {"labeled": [164, 473, 633, 919, 215, 1083, 304, 702, 395, 990, 483, 275, 462, 569, 1153, 88, 423, 459, 949, 91, 235, 899, 1226, 1057, 1221, 892, 198, 559, 153, 1171, 367, 630, 221, 997, 266, 1164, 492, 533, 240, 415], "labels": [5, 4, 7, 4, 7, 2, 8, 7, 1, 6, 3, 3, 1, 2, 3, 7, 6, 1, 6, 1, 5, 2, 2, 0, 2, 5, 2, 1, 7, 5, 1, 5, 0, 5, 0, 8, 4, 5, 4, 8], "strategy": "random", "B": 5, "seed": 79}, "expected": {"accuracy": 0.7833333333333333, "picks": [38, 1230, 928, 493, 1140], "proba_test0": [0.062406953586343475, 0.0018414118008996483, 0.02008107079701607, 0.37717744567757994, 0.0020637778374499125, 0.03816917759898411, 0.013280979356651415, 0.011021229693338479, 0.4729275762268818, 0.0010303774248552008]}}, {"name": "hybrid-60", "input": {"labeled": [876, 223, 463, 732, 1089, 721, 916, 346, 928, 1073, 1228, 1124, 423, 17, 314, 1230, 992, 419, 829, 143, 1094, 90, 553, 388, 283, 526, 754, 771, 1009, 855, 1110, 222, 186, 1163, 1071, 238, 591, 719, 545, 0, 509, 20, 858, 1150, 563, 490, 425, 940, 272, 1135, 919, 929, 974, 923, 276, 881, 1039, 213, 366, 1036], "labels": [4, 2, 4, 4, 3, 8, 9, 1, 2, 3, 6, 1, 6, 3, 3, 4, 1, 5, 9, 7, 2, 7, 7, 9, 6, 1, 1, 5, 0, 6, 5, 9, 1, 8, 0, 0, 8, 8, 7, 3, 7, 5, 3, 2, 1, 6, 7, 5, 0, 2, 4, 5, 9, 3, 4, 4, 2, 5, 8, 2], "strategy": "hybrid", "B": 5, "seed": 80}, "expected": {"accuracy": 0.8583333333333333, "picks": [170, 36, 1128, 989, 176], "proba_test0": [0.027361511851136666, 0.00039852443142851464, 0.008188879053524419, 0.0781758735282511, 0.000484334907661885, 0.05565473938716981, 0.0015994858843577202, 0.003749345362922777, 0.015275294671112535, 0.8091120109224346]}}]}
|
preview.png
ADDED
|
style.css
CHANGED
|
@@ -1,28 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 4 |
}
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
p {
|
| 12 |
-
color: rgb(107, 114, 128);
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
max-width: 620px;
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.card p:last-child {
|
| 27 |
-
margin-bottom: 0;
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:root {
|
| 2 |
+
--bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f22; --muted: #5f6670; --line: #dcdfe3;
|
| 3 |
+
--accent: #0b6e4f; --accent-soft: #e3f1ec; --warn: #a4471b; --warn-soft: #fbeee6;
|
| 4 |
+
--blue: #2f5fb3; --gold: #b07d12; --red: #c0392b;
|
| 5 |
}
|
| 6 |
+
@media (prefers-color-scheme: dark) {
|
| 7 |
+
:root {
|
| 8 |
+
--bg: #15171a; --panel: #1e2125; --ink: #eceef0; --muted: #a5acb5; --line: #33383e;
|
| 9 |
+
--accent: #4cc39a; --accent-soft: #1b3229; --warn: #f0a070; --warn-soft: #3a2519;
|
| 10 |
+
--blue: #7ea6f0; --gold: #e0b44c; --red: #f07a6c;
|
| 11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
+
* { box-sizing: border-box; }
|
| 14 |
+
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
|
| 15 |
+
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
|
| 16 |
+
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
|
| 17 |
+
header h1 { font-size: 1.6rem; margin: 4px 0 2px; letter-spacing: -0.01em; }
|
| 18 |
+
header p { margin: 0 0 8px; color: var(--muted); max-width: 70ch; }
|
| 19 |
+
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
|
| 20 |
+
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line); }
|
| 21 |
+
.badge.warn { background: var(--warn-soft); color: var(--warn); }
|
| 22 |
+
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
|
| 23 |
+
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
|
| 24 |
+
.card h2 { font-size: 1.02rem; margin: 0 0 8px; }
|
| 25 |
+
.card h3 { font-size: .95rem; margin: 10px 0 6px; }
|
| 26 |
+
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 3px; }
|
| 27 |
+
input[type=text], textarea, select { width: 100%; font: inherit; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
|
| 28 |
+
textarea { min-height: 110px; resize: vertical; }
|
| 29 |
+
input[type=range] { width: 100%; }
|
| 30 |
+
button { font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
|
| 31 |
+
button.ghost { background: transparent; color: var(--accent); }
|
| 32 |
+
button:disabled { opacity: .5; cursor: default; }
|
| 33 |
+
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
| 34 |
+
canvas { max-width: 100%; height: auto; display: block; border-radius: 6px; }
|
| 35 |
+
.card > canvas { width: 100%; }
|
| 36 |
+
.muted { color: var(--muted); }
|
| 37 |
+
.small { font-size: 13px; }
|
| 38 |
+
.status { font-size: 13px; color: var(--muted); min-height: 1.4em; }
|
| 39 |
+
table { border-collapse: collapse; width: 100%; font-size: 13px; }
|
| 40 |
+
th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
| 41 |
+
th { color: var(--muted); font-weight: 600; }
|
| 42 |
+
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
|
| 43 |
+
.scroll { overflow-x: auto; }
|
| 44 |
+
mark { background: #ffe58a; color: #1d1f22; padding: 0 2px; border-radius: 3px; }
|
| 45 |
+
mark.weak { background: #fff3c4; }
|
| 46 |
+
video { width: 100%; border-radius: 8px; }
|
| 47 |
+
footer { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
|
| 48 |
+
a { color: var(--blue); }
|
| 49 |
+
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
| 50 |
+
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg); font-size: 13px; cursor: pointer; color: var(--ink); }
|
| 51 |
+
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
|
| 52 |
+
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
|
| 53 |
+
.kpi div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
|
| 54 |
+
.kpi b { display: block; font-size: 1.15rem; }
|
| 55 |
+
.kpi span { font-size: 12px; color: var(--muted); }
|