Skip to content

feat(infer-13,#8081): §B-degenerate case where majority vote fails (C# twin of #8344) - #8359

Closed
myia-po-2023 wants to merge 1 commit into
mainfrom
feature/infer13-crowdsourcing-prongb-8081
Closed

myia-po-2023 wants to merge 1 commit into
mainfrom
feature/infer13-crowdsourcing-prongb-8081

Conversation

@myia-po-2023

Copy link
Copy Markdown
Collaborator

feat(infer-13,#8081): add §B-degenerate case where majority vote fails (C# twin of PyMC-13 #8344)

Infer-13-Crowdsourcing §5 used majority vote as the "baseline" and reached 5/5 = 100%
on the section-1 dataset (C26). This is precisely the §B-DEGENERATE case where the
trivial baseline EQUALS the model: all workers there are reliable, so majority vote
suffices, and the Biased Worker capability (§4, C21 recovers W4's confusion matrix
true=1 -> responds 0 @ 0.79) is INVISIBLE. The student never sees WHY a probabilistic
model is worth its cost over plain vote counting. Same defect class as the PyMC-13 C#
twin backfilled in #8344 (c.869).

Backfill (after M27 "### Analyse du vote majoritaire", before M28 "## 5bis"):

  • markdown cell: frames the degenerate case (clean dataset -> MV = model -> capability
    invisible) and sets up the adversarial scenario.
  • self-contained code cell: builds an ADVERSARIAL dataset (2 reliable truth-tellers
    • 3 always-0 spammers, 6 items). Majority vote FAILS (50%: the 3 true=1 items are
      outvoted by spammers). A reliability-WEIGHTED vote -- the mechanism the Dawid-Skene /
      Biased model provides via per-worker confusion matrices (§4, exercise 10) --
      neutralizes the spammers and RECOVERS the labels (100%, 3 items recovered).
      Output: MV 50% | weighted 100%, 3 items recuperes.

The demo is self-contained (no Infer.NET dependency, deterministic, no seed) and does
NOT solve the Dawid-Skene exercise (C46 stub) -- it shows the principle concretely.
Real Infer.NET Biased Worker model (§4) is intact and demonstrated; this adds the
discriminating case that makes its advantage visible.

Validation (gold-standard C.2, proven at 3 levels):

  • C.2: demo cell executed in the REAL .net-csharp kernel (jupyter nbconvert --execute).
    Committed output == kernel output byte-for-byte (28 CRLF stream chunks -- matches the
    committed sibling-cell convention: C11 38 chunks, C26 8 chunks, all CRLF Windows
    dotnet-interactive). FR decimal comma (0,50) consistent with Infer-13 house style
    (C21 "0,92"). No Kestrel/Microsoft.Hosting banner leaked into cell output.
  • CS0128/CS0136 RULED OUT: simulated shared-submission exec (C11 + C26 + demo cell in
    one C# scope, replicating dotnet-interactive's shared submission) compiles and produces
    the exact demo output -- no variable collision.
  • Byte-stable: +297/-6. The -6 are EXACTLY the 6 execution_count bumps (ec cascade:
    new cell ec=9, bumps C29..C48 9->10 ... 14->15, descending order). Zero source line,
    zero output of any pre-existing cell changed (verified: bumped + other cells source &
    outputs byte-identical to origin).
  • H.3 validate_pr_notebooks.py vs origin/main: PASS (1/1, 15 code cells, .net-csharp).
  • nbformat VALID (52 cells, was 50). C.1: 0 violations. Leak scanner: Infer-13 not
    flagged (demo is a standalone demo, not an exercise solution).

See #8081 (audit fidelite Probas/Infer.NET + PyMC) and #3801 (SOTA axe-2 problem-richness).
C# twin parity follow-up to #8344 (PyMC-13).

Co-Authored-By: Claude-Code noreply@anthropic.com

…s (C# twin of PyMC-13 #8344)

Infer-13-Crowdsourcing §5 used majority vote as the "baseline" and reached 5/5 = 100%
on the section-1 dataset (C26). This is precisely the §B-DEGENERATE case where the
trivial baseline EQUALS the model: all workers there are reliable, so majority vote
suffices, and the Biased Worker capability (§4, C21 recovers W4's confusion matrix
true=1 -> responds 0 @ 0.79) is INVISIBLE. The student never sees WHY a probabilistic
model is worth its cost over plain vote counting. Same defect class as the PyMC-13 C#
twin backfilled in #8344 (c.869).

Backfill (after M27 "### Analyse du vote majoritaire", before M28 "## 5bis"):
  - markdown cell: frames the degenerate case (clean dataset -> MV = model -> capability
    invisible) and sets up the adversarial scenario.
  - self-contained code cell: builds an ADVERSARIAL dataset (2 reliable truth-tellers
    + 3 always-0 spammers, 6 items). Majority vote FAILS (50%: the 3 true=1 items are
    outvoted by spammers). A reliability-WEIGHTED vote -- the mechanism the Dawid-Skene /
    Biased model provides via per-worker confusion matrices (§4, exercise 10) --
    neutralizes the spammers and RECOVERS the labels (100%, 3 items recovered).
    Output: MV 50% | weighted 100%, 3 items recuperes.

The demo is self-contained (no Infer.NET dependency, deterministic, no seed) and does
NOT solve the Dawid-Skene exercise (C46 stub) -- it shows the principle concretely.
Real Infer.NET Biased Worker model (§4) is intact and demonstrated; this adds the
discriminating case that makes its advantage visible.

Validation (gold-standard C.2, proven at 3 levels):
- C.2: demo cell executed in the REAL .net-csharp kernel (jupyter nbconvert --execute).
  Committed output == kernel output byte-for-byte (28 CRLF stream chunks -- matches the
  committed sibling-cell convention: C11 38 chunks, C26 8 chunks, all CRLF Windows
  dotnet-interactive). FR decimal comma (0,50) consistent with Infer-13 house style
  (C21 "0,92"). No Kestrel/Microsoft.Hosting banner leaked into cell output.
- CS0128/CS0136 RULED OUT: simulated shared-submission exec (C11 + C26 + demo cell in
  one C# scope, replicating dotnet-interactive's shared submission) compiles and produces
  the exact demo output -- no variable collision.
- Byte-stable: +297/-6. The -6 are EXACTLY the 6 execution_count bumps (ec cascade:
  new cell ec=9, bumps C29..C48 9->10 ... 14->15, descending order). Zero source line,
  zero output of any pre-existing cell changed (verified: bumped + other cells source &
  outputs byte-identical to origin).
- H.3 validate_pr_notebooks.py vs origin/main: PASS (1/1, 15 code cells, .net-csharp).
- nbformat VALID (52 cells, was 50). C.1: 0 violations. Leak scanner: Infer-13 not
  flagged (demo is a standalone demo, not an exercise solution).

See #8081 (audit fidelite Probas/Infer.NET + PyMC) and #3801 (SOTA axe-2 problem-richness).
C# twin parity follow-up to #8344 (PyMC-13).

Co-Authored-By: Claude-Code <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Golden-Set Execution (H.7 P3)

✅ 8/8 notebooks passed (certified reproducible)

Notebook Status Time
2.1-Workflow-ML.ipynb ✅ SUCCESS 7.3s
2.2-Descente-de-gradient.ipynb ✅ SUCCESS 4.4s
2.3-Regression-lineaire-logistique.ipynb ✅ SUCCESS 4.0s
2.4-Arbres-Forets-Ensembles.ipynb ✅ SUCCESS 5.0s
Search-1-StateSpace.ipynb ✅ SUCCESS 4.0s
SL-1-LogicalLearning.ipynb ✅ SUCCESS 3.2s
rl_4_multi_armed_bandits.ipynb ✅ SUCCESS 26.5s
GameTheory-4c-NashExistence-Python.ipynb ✅ SUCCESS 3.6s

Pinned lockfile: scripts/notebook_tools/golden_set.lock.txt (H.7 P3, axe A #4208)

@github-actions

Copy link
Copy Markdown
Contributor

Notebook PR Validation: PASS

  • Notebooks checked: 2
  • Code cells validated: 35
  • Result: All passed

Checks: H.1 (no errors), H.3 (execution_count), C.1 (no banned patterns)
Non-Python kernels (.NET/Lean): C.1 + errors only (execution_count advisory)
QuantConnect notebooks: C.1 + errors only (require QC Cloud for execution)

@jsboige jsboige left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Hermes] Vérifié le cas limite MV-failure vs vote pondéré (Infer-13 §B) :

Math vérifiée à la main ✅

  • Dataset : 6 items × 5 workers (W1,W2 fiables ; W3,W4,W5 toujours-0).
  • MV : Items 0-2 → {1,1,0,0,0} = 3×0 vs 2×1 → MV=0, vrai=1 → ERREUR ×3. Items 3-5 → MV=0 = vrai → OK. Total 3/6 = 50% ✓.
  • Poids (variance empirique) : W1/W2 var=0.25 (réponses varient), W3-W5 var=0 (constantes). Spammers = poids nul ✓.
  • Vote pondéré : Items 0-2 s1=0.50 > s0=0 → 1 ✓. Items 3-5 s0=0.50 > s1=0 → 0 ✓. 6/6 = 100% ✓.

Authenticité ✅ : outputs cohérents avec le code. ec renumérotés correctement (9→10…14) indiquant une réexécution top-to-bottom, contrairement au doublon ec signalé sur #8360. Bonne pratique.

Pédagogie : l'utilisation de la variance comme proxy de fiabilité est une simplification volontaire, clairement signalée dans le markdown comme pointant vers Dawid-Skene (§4/ex.10). Pas de problème.

No leaks, no !pip. RAS.

@jsboige

jsboige commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Course-loss reconcile (regle reconcile-duplicate-close-loser-only). #8360 (Dawid-Skene EM complet, mirror algorithmique fidele du twin Python #8344) merge a 16:15Z au meme point d'insertion Infer-13 SS-B. #8359 implemente un weighted-vote simplifie: pedagogiquement honnete et C.2-proven, mais PAS le DS-EM lui-meme, donc moins fidele au twin #8344 pour la parite #8057. Validation independante en double-blind appreciee (meme finding confirme). On ferme le perdant seul; #8360 reste canonique. Un intro weighted-vote AVANT l'EM, si voulu, sera un grain scope separe (pas un re-push du meme point). Merci du collision-flag honnete (lecon: [CLAIMED] des le debut du grain, meme sur continuation d'audit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants