Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 25 — Assignment Project: Learning a Triage Network from Records

Open in Colab

Overview

An emergency department wants a Bayesian network over ten yes/no variables of its patients, to estimate risks at triage. A senior doctor drew a graph (the expert graph, below); the department also has records. You will learn the tables, test the expert’s graph against one learned from the records, learn from records with holes, and see how much data each step needs.

The records are simulated from a network that plays the role of reality. Its code is in the setup cell (_reality): do not use it before Part D, where you compare your learned graphs with it.

PartTaskPoints
ATables for the expert graph, and the strength of the prior20
BA learned graph against the expert’s25
CRecords with holes: EM against complete cases20
DHow much data the structure needs20
ERecommendation15

Part A — Tables for the Expert Graph, and the Strength of the Prior (20 points)

  1. Fit the expert graph’s tables on the first 300 training records with α∈{0,0.1,0.5,1,2,5,10}\alpha \in \{0, 0.1, 0.5, 1, 2, 5, 10\} and report each one’s validation log-likelihood. Which α\alpha is best?

  2. Repeat with all 3 000 training records. How does the best α\alpha, and the difference it makes, change? Explain.

Your explanation:


Part B — A Learned Graph against the Expert’s (25 points)

  1. Learn a graph from the 3 000 training records by hill climbing on the BIC (add, delete and reverse moves, at most 3 parents), with at least 10 random restarts. (You may adapt the chapter’s code.)

  2. Fit both graphs’ tables with the α\alpha chosen in Part A, and compare their validation log-likelihoods and their BIC on the training records.

  3. List the edges in which the two graphs differ (taking an edge’s reversal as a match), and for each say whether the records support the expert or not: compare the BIC of the expert graph with and without that edge.

Your comparison:


Part C — Records with Holes: EM against Complete Cases (20 points)

In the department’s real records, two values are often missing: Pneumonia (the X-ray is not always done) and LowOxygen (the oximeter reading is not always written down). The cell below makes the training records with holes: Pneumonia is missing in 40% of records at random; LowOxygen is missing in 50% of the records without fever and 10% of those with fever.

  1. Which kind of missingness is each (MCAR, MAR, MNAR)? Why?

  2. Fit the true structure’s graph (use _reality()[0] here: this part is about the tables) by (a) complete-case analysis and (b) EM. Report the test log-likelihood of each, and P(Infection)P(\text{Infection}) and P(Pneumonia=1∣old, non-smoker, infection)P(\text{Pneumonia} = 1 \mid \text{old, non-smoker, infection}), compared with the full records.

  3. Explain any bias you find in the complete-case tables.

Your answers:


Part D — How Much Data the Structure Needs (20 points)

Now compare with reality. Learn a graph from 300, 1 000, 3 000 and 20 000 records (use MORE for the last), and for each report: the skeleton edges right, missed and extra against _reality()[0], whether the v-structures match, and the test log-likelihood (tables with α=1\alpha = 1). Which true edges are found last, and why those?

Your answer:


Part E — Recommendation (15 points)

Write a short recommendation (half a page) to the department: should they use the expert’s graph, a learned graph, or a combination? How should they handle the missing X-rays and oximeter readings, and what should they change in how records are kept? Support each point with your numbers.

Grading Rubric

CriterionExcellentAdequateInsufficient
A (20)the validation curve at both sizes, with the change in the best α\alpha explainednumbers onlymissing
B (25)a learned graph with restarts; both compared on held-out data; each disputed edge testeda learned graph onlymissing
C (20)missingness classified correctly; EM and complete cases compared; the bias explainedone methodmissing
D (20)four sizes compared with reality; the late edges explained by their strength or raritysome sizesmissing
E (15)a recommendation grounded in the numbersgenericmissing