Project A — mastery check The second opinion

The quality team read about deep learning and asks whether the risk flag should be rebuilt as a neural network. Give them a second opinion they can act on — backed by a notebook you wrote.

Scaffolding provided

A starter notebook (project-starter.ipynb) with load_and_recode(), split_by_patient(), and the MNIST loader already written, a split_by_patient_3way(df, seed, val_size, test_size) stub (signature only — s4-2 taught it, the body is yours), and one empty labelled cell per checkpoint.

Checkpoints

Each checkpoint is one observable artifact you build yourself. Checking all six flips this module's mastery to "project complete" in the tracker. No auto-grading — you mark it once the artifact exists.

The neuron, re-derived

One held-out patient's Module 03 logistic-regression probability recomputed as a neuron in raw numpy and in PyTorch; three numbers agree to 4 decimals.

What a solid version includes (open only after you've attempted it)

Uses the actual s2-2 weights, not refit; states in one sentence what changes when a second layer is added.

The chain

A 3-parameter chain (two weights + one bias) with both hand-derived gradients, PyTorch autograd's gradients, and a finite-difference check, all in one table.

What a solid version includes (open only after you've attempted it)

The bias term derived (not copied from s3-1); the update rule quoted as Module 03's line; the finite-difference ε stated.

The build

The MLP trained on a patient-safe three-way split with train and validation loss curves saved as a figure, and AUC + recall at matched flagged rate on the test rows.

What a solid version includes (open only after you've attempted it)

Standardised on train statistics only; seed fixed; the validation slice never used for scoring; architecture drawn or listed.

The brake

An overfitting curve produced deliberately, then one countermeasure applied, before/after curves side by side, and one sentence on why it helps.

What a solid version includes (open only after you've attempted it)

The stopping epoch/patience/p/λ chosen using validation, not test; the sentence names the mechanism (ensemble of thinned nets / capacity capped by time / weights taxed), not just "it regularises."

The scoreboard

Four models (logistic, tree, MLP, boosted ensemble) on identical test rows, AUC and recall at matched flagged rate, each placed on the inspectability spectrum.

What a solid version includes (open only after you've attempted it)

Reports the direction the data gives; places the ensemble and the MLP correctly on the spectrum; does not use accuracy (Module 03's 88.8% trap).

The memo

≤1 page, plain language, no code: should the flag move to a neural net? Answer first; evidence; what it would cost (data, compute, audit); the one situation where the answer flips.

What a solid version includes (open only after you've attempted it)

Leads with the answer; cites the scoreboard numbers; names auditability as a cost in a hospital; the flip case is unstructured data (points at s5-1) and does not overclaim beyond it.

Stretch (optional, non-gating)

Widen the diabetes input with one-hot-encoded age and admission_type_id (categorical encoding wasn't taught in this module — you're on your own here, which is the point) and see whether the MLP's rank in the scoreboard moves.