Back to Main Index Open Learning Roadmap

Label Quality and Outcome Definition in EHR ML

A machine learning model cannot be better than the label it learns from. In health datasets, labels are often built from diagnosis codes, chart review, prescriptions, procedures, or future events. This page teaches students how to think clearly about what the outcome means, how noisy it is, and whether the label matches the real clinical decision they want to support.

Beginner Learn what a label is, why outcome definitions matter, and why billing codes are not always the same as truth.
Intermediate Compare proxy outcomes, chart review, and registry labels while checking leakage risk and clinical usefulness.
Advanced Think about time zero, adjudication, phenotyping drift across hospitals, and how label noise distorts validation.
1 Core rule: define the target before choosing the model
4 Useful label questions: what, when, who decides, and how noisy is it
Noise Weak or inconsistent labels can make a strong model look worse or falsely better

Why this page matters

The portal already covers missing data, leakage, external validation, and bias. The next high-value gap is what students repeatedly face in EHR projects: the outcome itself may be ambiguous, delayed, site-specific, or only partly observed. If the label is poorly defined, downstream metrics and explanations become hard to trust.

Core idea: a label is a measurement choice, not a natural fact. Good health ML starts by making that choice explicit.

Three levels of label thinking

Beginner

What outcome are we trying to predict?

Students should first ask what the target means in plain language.

  • Example: in-hospital mortality, 30-day readmission, or sepsis in the next 12 hours.
  • The label should match the real decision the tool is meant to support.
  • If clinicians would not act on it, the label may be interesting but not useful.
Intermediate

How was the label created?

Many health labels are proxies built from codes, orders, or documentation rather than direct truth.

  • Billing codes are fast but may miss cases or vary by hospital.
  • Chart review is richer but expensive and sometimes inconsistent across reviewers.
  • Registries can be strong labels if timing and linkage are clear.
Advanced

What timing and noise assumptions are hidden?

Advanced students should inspect whether features leak future information and whether the target shifts across sites or years.

  • Post-outcome documentation can create artificial performance.
  • Different adjudicators may define the same phenotype differently.
  • Observed labels can be imperfect even when the clinical concept is valid.

Interactive label design lab

Choose a common EHR label strategy. Watch how collection speed, label noise, leakage risk, and clinical alignment move together. The point is not that one label is always best. The point is that every label choice trades convenience for validity.

Outcome definition monitor

Sepsis billing-code phenotype
Fast Collection speed
High Expected label noise
Moderate Leakage risk
Mixed Clinical alignment

Design signals

Speed and scalability High
Noise and misclassification High
Future-information leakage Moderate

What to notice

Billing codes can scale quickly, but they may reflect documentation and reimbursement processes as much as disease biology.

  • Check whether codes are finalized after the prediction window.
  • Inspect how coding practices differ across hospitals.
  • Sample charts to estimate how many true cases are missed.
Label warning: high apparent accuracy can come from predicting documentation habits instead of predicting the clinical event you care about.

Common label traps in health ML

Using future documentation

If discharge codes or finalized notes appear after the intended prediction time, the model may learn the answer key.

Proxy outcomes that change with practice

Treatment orders, ICU transfer, or consultation requests can reflect clinician behavior rather than disease itself.

Site-specific phenotype rules

The same code list or abstraction rule may behave differently across hospitals, years, or coding teams.

Ignoring uncertain cases

Borderline or ambiguous cases are often where label noise is highest, yet they matter most for real deployment.

Safety note: if the outcome is defined by clinician actions, the model can inherit existing care inequalities and workflow biases.

A practical workflow for defining EHR labels

1

Write the clinical question first

Define the decision, the patient group, and the prediction time in plain language before opening the database.

2

Set time zero clearly

Choose the exact moment when prediction starts so features and labels can be checked against the same clock.

3

Choose the label source

Decide whether the outcome comes from codes, lab thresholds, chart review, registry linkage, or a hybrid phenotype.

4

Audit a sample manually

Review a subset of records to estimate false positives, false negatives, and edge cases in the outcome definition.

5

Check portability

Ask whether the same label logic would behave similarly across hospitals, calendar time, and coding workflows.

6

Document uncertainty

Report how the label was built, what its likely errors are, and where the phenotype is strongest or weakest.

Quick self-check

Use these short cases to confirm the main label-design logic before moving on.

Case 1

You predict sepsis at emergency department arrival, but your label uses discharge diagnosis codes finalized days later. Main concern?

Correct answer: Potential leakage. The label may depend on information only available after the prediction moment.

Case 2

A treatment order is used as the outcome, but treatment habits differ between hospitals. What should you suspect?

Correct answer: Label portability problems. Practice patterns can shift the meaning of the proxy outcome.

Case 3

Which extra step most improves confidence in a new phenotype built from ICD codes and labs?

Correct answer: Manual chart audit. A small adjudicated sample helps estimate label errors and edge cases.

How this connects to other portal pages

Before missing data and preprocessing

Read missing data and safe pipelines to prepare features only after the target and timing are defined.

Before leakage and validation

Use train, validation, test splits and leakage to ensure the outcome logic does not look into the future.

With bias and transportability

Connect this page to bias in ML and external validation when phenotype rules vary across settings.

Before future reproducibility topics

This page prepares students for later work on reporting standards, governance, and prospective validation.