Repository navigation
feat(probas,#3801): Prong-B Dawid-Skene discriminating-dataset C# demo (Infer-13 §5) - #8360
Conversation
…o (Infer-13 §5) Infer-13-Crowdsourcing §5 vote-majoritaire baseline hits 100% (5/5) on a clean 4-worker dataset: the Biased-Worker / Dawid-Skene capability is invisible (degenerate case, same gap PyMC-13 had pre-#8344). Add a self-contained C# EM demo after the §5 analysis (cell 27): 3 reliable workers + 2 always-1 spammers on 8 items -> majority vote falls to 75% (misses items 3,7), Dawid-Skene EM recovers 100% (+2 items). Confusion matrices show spammers correctly deprecated (P(pred=1|vrai=0)=1.0 AND P(pred=1|vrai=1)=1.0 = no information). Mirror of PyMC-13 #8344 (cell 27): identical dataset, identical diagonal-dominant init (0.8/0.1), 20 EM iterations. Pure C# (no Infer.NET), ds-prefixed locals to avoid CS0128 scope collision with §5 (nItems, labels, vraisLabels). Executed via .net-csharp kernel (dotnet-interactive): ec=9, 1 consolidated stream-stdout output, real 100,0% (8/8) + matrices. Byte-stable: +166/0 pure addition, LF structural (.gitattributes eol=lf, write_bytes), no catalog churn. See #3801 (Prong-B: non-trivial problem that exercises the engine).
Notebook PR Validation: PASS
Checks: H.1 (no errors), H.3 (execution_count), C.1 (no banned patterns) |
Golden-Set Execution (H.7 P3)✅ 8/8 notebooks passed (certified reproducible)
Pinned lockfile: |
clusterManager-Myia
left a comment
There was a problem hiding this comment.
[NanoClaw] structural review (glm-5.2 budget: file-list + 1 load-bearing notebook, base-vs-head cell-hash diff, no full patch)
CoursIA #8360 feat(probas,#3801): Prong-B Dawid-Skene discriminating-dataset C# demo (Infer-13 §5)
head fef1ec4d317f, base f79034711e75, +166/-0, 1f Infer-13-Crowdsourcing.ipynb (C# / Infer.NET polyglot). Author jsboige ≠ my identity → 0 self-review conflict. 0 secret, 0 leak, 0 CJK (whole-notebook scan clean).
LGTM deep — this is the canonical motivating example for Dawid-Skene, and it's done right. The §5 baseline (cell [26]) shows majority vote at 100% on clean data, then this PR honestly notes that's "too easy for Dawid-Skene to show its value" and builds the discriminating case where majority vote fails.
Verified by hand:
- +3 cells add-only (notebook 50→53, 0 deleted → rule 6 ✓): H[28] framing md ("Quand DS surpasse-t-il VRAIMENT MV ?"), H[29] code (discriminating dataset + DS EM), H[30] interpretation. Confirmed via base↔head content-hash diff — exactly these 3 cells are new.
- Majority vote math (5 workers, true={1,0,1,0,1,0,1,0}, W4/W5 spammers always-1): Item3 votes {0,1,0,1,1}→3 ones vs 2→MV=1, true=0 ✗; Item7 {0,0,1,1,1}→3 vs 2→MV=1, true=0 ✗. → 6/8 = 75%, errors exactly on {3,7}. Matches output byte-for-byte. ✓
- Dawid-Skene EM — textbook-correct implementation: E-step posterior
P(true=k|labels) ∝ 0.5 · ∏_w Conf[w,k,label[w,i]]normalized (canonical product-of-confusion-likelihoods with uniform prior); M-step soft countsConf[w,k,l] = Σ_i Post[i,k]·𝟙[label[w,i]=l] / Σ_i Post[i,k]; init diagonal-dominant (0.8 / 0.1); 20 iters. ✓ - Spammer detection sound: converged confusion matrices show W4/W5 with
Pred1=1.0on bothVrai0andVrai1rows → a vote carrying zero information, correctly deprecated by the posterior. W2/W3 show their honest single errors (Vrai0 row 0.75/0.25). DS recovers all 8 → 100%. Output is real EM convergence, not round-number fakes. ✓ - Interpretation [30] accurate and well-linked (forward to Community §6 + active learning §7 — the deprecated-spammer mechanic is exactly what those generalize).
▼ NIT — ec-doublon (same worker-po pattern flagged ×4 this week). H[29] carries ec=9, but the next code cell [32] also shows ec=9 (and [35] ec=10, etc. unchanged from base). The new cell executed standalone in the existing kernel (output real ✓), but the notebook was not re-run top-to-bottom → non-monotonic sequence 8,9,9,10. A reader doing "Run All" gets correct behavior; the static ec-bookkeeping just looks unrefreshed. Reco: re-execute the notebook top-to-bottom at head so the ec sequence is monotonic. Non-blocking (math + output both sound).
△ Cosmetic: int[,] dsLabels is worker-major (dsLabels[w,i], GetLength(0)=5) — internally consistent and matches the printed W×Item grid; just noting the indexing convention in case a later refactor touches it.
Net: a genuinely well-chosen discriminating dataset (3 reliable + 2 always-1 spammers is the minimal case that breaks MV but not DS) with a correct from-scratch EM. Mergeable; the ec nit is a re-execute polish.
…clear fleet-red gate) (#8372) The Twin parity audit gate (#8185 = BLOCKING) was fleet-RED on every open PR because 15 registered twin pairs drifted on origin/main: merged PRs that modify a registered twin notebook (citations, Prong-B enrichment, determinism seed, metadata.cost rollout, nbformat cell-id fix) did not rebaseline their last_audit.{python,csharp}_sha, so the recorded SHA lagged the merged blob. G.8 audited resync (NOT rubber-stamped) — every drift traces to a NAMED merged PR (verified via git log -- <notebook> between recorded and current blob): - Coordinated twin updates (parallel PRs both sides): Z3-06 (#8328+#8353), ML-7 (#8284 both), Probas-6 (#8366+#8349), Probas-8 (#8330+#8355), Probas-11/#8325 both, Probas-13 (#8344+#8360), Probas-15/16/17 citation twins. - Framework-specific infra (asymmetric, benign): Probas-3/4/12 C#-only = #8323 metadata.cost rollout (PyMC twins have no such frontmatter yet); CSP-3 PY-only = #8252 OR-Tools CpSolver seed (C# twin uses Choco Solver, deterministic default search — different lib, no parity break, spot-checked); Search-3 PY-only = #8324 IDA* prose reframe + #7252 FR accents. Independently re-confirms the G.1 firsthand claim (jsboige c.03:58, po-2023 c.04:08 merge-sim) on the CURRENT origin/main state (8743caf): all 15 are stale-sha-only, ZERO content drift that broke semantic parity. Surgical method (NOT check_twin_parity.py --update): --update yaml.safe_dump's the ENTIRE curated YAML -> 1350-line churn + strips the header comment block (measured). Instead: context-free exact string replacement of each old->new 40-char git blob SHA (all 25 old shas unique, verified -> unambiguous). Result: +25/-25 = 50 lines, ONLY python_sha/csharp_sha fields changed; header comments, known_differences prose, indentation, LF line-ending byte-preserved (GATE A-C). Proof: check_twin_parity.py --check -> OK=39 DRIFT=0 exit 0 (CI-green). See #8264 (resync of existing drifts; 'going-forward enforcement' = documented precedent #8057, separate concern). See #8057, #8185. Co-authored-by: Claude <noreply@anthropic.com>
Summary
Infer-13-Crowdsourcing§5 vote-majoritaire baseline hits 100 % (5/5) on a clean 4-worker dataset: the Biased Worker / Dawid-Skene capability is invisible there (degenerate case — the exact gapPyMC-13had before #8344). This PR adds a self-contained C# EM demo right after the §5 analysis (cell 27) that makes the capability visible in the numbers.Discriminating dataset (3 reliable workers + 2 always-1 spammers, 8 items):
The confusion matrices show the spammers correctly deprecated:
P(pred=1|vrai=0)=1.0ANDP(pred=1|vrai=1)=1.0— a vote carrying no information.Why (Prong-B, #3801)
The §5 dataset is too easy: every worker is reliable, so majority vote is already optimal and Dawid-Skene has nothing to show. The notebook claimed Dawid-Skene's value (cell 27 admits "the real value appears on heterogeneous datasets") but never demonstrated it. This cell builds the biased-worker case where the engine's distinctive capacity (recognize + depreciate non-informative workers) actually changes the outcome. Mirror of the Python twin fix #8344 (PyMC-13 cell 27).
Execution proof (C.2 / H.3)
.net-csharp(dotnet-interactive), executed viajupyter nbconvert --executeexecution_count: 9, 1 consolidated stream-stdout output (real kernel output)Precision : 100,0% (8 / 8)+>>> Dawid-Skene récupère 2 item(s) (100,0% vs 75,0%)NotImplementedException/assert False/1/0#r "nuget:"headless blockerImplementation notes
W1perfect,W2err item3,W3err item7,W4/W5spammers), same diagonal-dominant init (0.8/0.1), 20 EM iterations. (An earlier attempt used a canonical MV-empirical init that landed in a wrong EM basin at 87.5 % — the diagonal-dominant init matching the Python twin converges correctly to 100 %.)ds-prefixed locals (dsTrue,dsLabels,dsConf,dsPost…) to avoid CS0128 scope collision with §5 (nItems,labels,vraisLabels).### Analyse du vote majoritaire), before## 5bis. Exercice.Byte-stability
+166 / 0pure addition (no existing cell touched).gitattributeseol: lf, written viawrite_bytes— avoids Windowswrite_textCRLF translation)COURSE_CATALOG.generated.*untouched)100,0%) consistent with the rest of the Infer seriesSee #3801 (Prong-B).