HeartWise AI

Science companion

Understand every number, test, and AI term.

This guide explains what the model sees, how each measurement is collected, how the computer learns, and what students should say during the exhibition.

First principles

The project in four ideas

01

Data

A collection of recorded facts. Here, each row describes one historical example and each column describes one feature.

02

Pattern

A relationship that appears repeatedly—for example, a combination of several measurements that often appears with one outcome.

03

Model

A mathematical system created during training. It stores learned coefficients, not copies of classroom visitors.

04

Prediction

The model applies its learned mathematics to a new fictional row and returns a pattern-match score.

1 Medical measurements2 Numbers and codes3 Trained equation4 Educational result

The 13 model inputs

Medical terms and measurements

These are descriptions of the historical dataset—not instructions to perform medical tests at school. Tests such as stress ECGs and angiography must only be performed by qualified professionals.

PERSON INFORMATION

Information read from the historical record

01AgeDataset name: ageyears

Simple meaning: How many complete years old the person was.

How obtained: From the person’s date of birth or medical record. It is not measured by the AI.

What the model receives: One number, such as 55.

Why it can matter: Body systems and disease patterns can change with age. Age alone never decides the result.

02Sex recorded in the datasetDataset name: sex0 or 1

Simple meaning: The historical file stores two sex categories: 0 = female and 1 = male.

How obtained: From the original medical record; the model does not examine or measure a person.

Limitation: A binary field does not represent everyone. It also contains no information about gender identity. This is a clear example of how old datasets can limit an AI system.

RESTING MEASUREMENTS

Recorded while the person was not exercising

03Chest-pain patternDataset name: chest-paincodes 1–4

Simple meaning: A clinician classified the reported symptoms—not how painful they felt.

1 Typical angina: classic exertion-related pattern2 Atypical angina: some, but not all, classic features3 Non-anginal pain: does not fit the classic pattern4 Asymptomatic: no chest-pain symptom reported

How obtained: By asking questions about the symptom, what brings it on, and what relieves it. Only a clinician should classify real chest pain.

Important: “Asymptomatic” does not mean “healthy”; it only says the symptom was not reported.

04Resting blood pressureDataset name: rest-bpmmHg

Simple meaning: Blood pressure is the force of blood pushing against artery walls. A normal reading has two numbers, such as 120/80.

How measured: An inflatable cuff called a sphygmomanometer wraps around the upper arm. As air is slowly released, the device detects pressure.

What this dataset stores: Only the systolic value—the first number, when the heart contracts—recorded at rest on hospital admission. Example: 130.

Unit: mmHg means millimetres of mercury, a pressure unit. The second, diastolic value is not included.

05Serum cholesterolDataset name: serum-cholmg/dL

Simple meaning: Cholesterol is a waxy, fat-like substance carried in blood. The body needs some, but certain patterns can be linked with plaque in arteries.

How measured: A health professional takes a blood sample. A laboratory measures cholesterol in the liquid part of blood, called serum.

What this dataset stores: One serum-cholesterol number. It does not separately show LDL (“bad”), HDL (“good”), or triglycerides.

Unit: mg/dL means milligrams of substance in one decilitre (100 mL) of blood.

06Fasting blood sugar flagDataset name: fasting-blood-sugar0 or 1

Simple meaning: Glucose is a sugar in the blood and a main source of energy for cells.

How measured: Usually from a blood sample after no food or drink except water for at least eight hours.

What this dataset stores: Not the exact measurement. It stores 0 = 120 mg/dL or lower and 1 = above 120 mg/dL.

Information loss: Values of 90 and 119 both become 0; values of 121 and 200 both become 1. This shows how converting a measurement into a yes/no category removes detail.

07Resting ECG resultDataset name: electrocardiographiccodes 0–2

Simple meaning: An electrocardiogram—ECG or EKG—is a painless recording of the heart’s electrical activity.

How measured: Sticky sensors called electrodes are placed on the chest, arms, and legs. Wires connect them to a machine that draws a waveform.

0 Normal historical ECG category1 ST–T wave abnormality2 Probable or definite left-ventricular hypertrophy by the dataset’s criteria

Vocabulary: ST and T are sections of the ECG trace related to the lower chambers recovering electrically. The left ventricle is the main pumping chamber; hypertrophy means thickening.

EXERCISE STRESS TEST

Monitored by healthcare professionals while exercise becomes harder

What happens in a stress test?Electrodes record an ECG+A cuff measures blood pressure+The person walks on a treadmill or pedals a bicycleThe workload gradually increases
08Maximum heart rate achievedDataset name: max-heart-ratebpm

Simple meaning: The fastest recorded heartbeat reached during the exercise test—not the resting pulse.

How measured: ECG electrodes detect each heartbeat while the person exercises. The machine counts beats per minute.

Unit: bpm means beats per minute. Example: 150 bpm.

Important: A value cannot be judged alone; age, medicines, fitness, the test protocol, symptoms, and other information matter.

09Exercise-induced anginaDataset name: angina0 or 1

Simple meaning: Whether angina-like chest discomfort occurred when the heart worked harder during the test.

How obtained: The person reports symptoms while professionals monitor the ECG, blood pressure, and condition.

Dataset codes: 0 = no, 1 = yes.

Safety: Students must never copy an exercise stress test. It is a supervised clinical procedure with stopping rules.

10Oldpeak / ST depressionDataset name: oldpeakdecimal value

Simple meaning: The model compares the ST section of the ECG during exercise with the ST section at rest. A downward change is called ST depression.

How measured: A clinician or ECG system compares the stress-test waveform with the resting waveform.

What the dataset stores: A decimal such as 1.2 or 2.4. The official Statlog description does not state a unit, so the project should say “dataset value,” not invent a unit.

Name warning: “Oldpeak” is an old dataset column name; it does not mean an old heart rate.

11Peak exercise ST slopeDataset name: slopecodes 1–3

Simple meaning: At peak exercise, the ST part of the ECG line can trend upward, stay relatively flat, or trend downward.

How measured: From the ECG waveform during the stress test.

1 Upsloping2 Flat3 Downsloping

Important: The code is a category, not an angle measured by the student.

HISTORICAL IMAGING RESULTS

Specialist procedures represented as simplified codes

12Major vessels coloured by fluoroscopyDataset name: major-vessels0–3 vessels

Simple meaning: The historical data records how many major heart vessels became visible (“coloured”) during X-ray imaging with contrast dye.

How obtained: In coronary angiography, a clinician guides a thin catheter through a blood vessel, injects contrast dye, and uses moving X-ray images called fluoroscopy.

What the dataset stores: A count from 0 to 3, not the X-ray image itself.

Safety: This is an invasive hospital procedure with risks. It is explained only because the public dataset contains the result.

13Historical “thal” scan resultDataset name: thalcodes 3, 6, 7

Simple meaning: A historical coded scan result associated with the heart’s blood-flow testing.

3 Normal6 Fixed defect: the abnormal-looking area remains7 Reversible defect: the area changes between stress and rest

How obtained: This field is commonly linked with a thallium/nuclear stress scan, in which a tracer and special camera show blood flow at stress and rest.

Careful wording: The official Statlog file calls the field only “thal” and supplies the codes. Present it as a historical scan code; do not call it a test for thalassemia.

THE ANSWER USED DURING TRAINING

This is the label, not an input

14Known outcome / targetDataset role: class1 or 2

Simple meaning: The historical answer paired with the 13 inputs so the model can learn.

Original codes: 1 = absence and 2 = presence of the dataset’s heart-disease outcome. The app converts these internally to 0 and 1 for machine learning.

Why it is not entered: For a new sample, this answer is unknown. Predicting a pattern related to this label is the model’s task.

Show the judges

One real dataset row, decoded

This is the first public record in the bundled file. It is a de-identified historical training example—not a visitor and not one of the fictional demo profiles.

WHAT THE FILE CONTAINS70.0 1.0 4.0 130.0 322.0 0.0 2.0 109.0 0.0 2.4 2.0 3.0 3.0 2

Fourteen values separated by spaces: 13 inputs followed by 1 known outcome.

#ColumnStored valueHuman-readable meaningKind of data
1Age7070 yearsNumber
2Sex1Male in the historical codingCategory
3Chest-pain pattern4Asymptomatic categoryCategory
4Resting blood pressure130130 mmHg systolicNumber
5Serum cholesterol322322 mg/dLNumber
6Fasting blood sugar flag0Not above 120 mg/dLYes/no category
7Resting ECG2Historical LVH categoryCategory
8Maximum heart rate109109 bpm during exercise testNumber
9Exercise angina0NoYes/no category
10Oldpeak2.4ST-depression dataset value of 2.4Decimal number
11ST slope2FlatOrdered category
12Major vessels33 vessels coloured by fluoroscopyCount
13Thal scan code3Normal categoryCategory
14Known outcome2Presence class in the source datasetTarget label
Row

One example, arranged horizontally. This dataset has 270 rows.

Column

One type of information repeated for every row.

Feature

An input column used by the model. There are 13 features.

Label

The known answer used during supervised training.

Inside the computer

How logistic regression learns

It is called “regression,” but here it is used for classification: choosing between two learned classes.

1

Prepare the numbers

Numeric features are standardized: the training average is subtracted and the result is divided by the training spread. This puts different units on comparable scales.

standardized value = (value − training average) ÷ training spread
2

Encode the categories

One-hot encoding turns each category into switches. For ST slope, the computer can create three switches: upsloping, flat, and downsloping. Exactly one is on.

Flat → [0, 1, 0]
3

Learn coefficients

During training, logistic regression adjusts a weight called a coefficient for every prepared input. A positive contribution pushes toward the presence pattern; a negative contribution pushes toward the absence pattern.

weighted total = bias + (weight₁ × input₁) + …
4

Turn the total into a score

The sigmoid function bends any weighted total into a number between 0 and 1. The app multiplies it by 100 and calls it a pattern score.

score = 1 ÷ (1 + e−weighted total)
5

Choose an educational band

The app uses display thresholds. These are project choices, not medical cut-offs.

0–34% Lower35–64% Moderate65–100% Higher
6

Explain this prediction

The XAI panel multiplies each prepared input by its coefficient, groups encoded categories back into their original feature, and shows the four largest absolute contributions.

local contribution ≈ prepared input × learned coefficient

Artificial intelligence (AI)

A broad name for computer systems that perform tasks associated with human intelligence, such as recognizing patterns.

Machine learning (ML)

A type of AI where a computer learns a mathematical pattern from examples instead of receiving every rule by hand.

Algorithm

A step-by-step procedure. Logistic regression is the learning algorithm used here.

Model

The trained mathematical result—the coefficients and preprocessing learned from the training data.

Supervised learning

Learning from examples that include both inputs and a known correct label.

Classification

Assigning an example to a class. The source classes are absence and presence.

Training

The process of adjusting coefficients using historical examples and known outcomes.

Inference / prediction

Using the already-trained model on a new row. The model does not retrain for each visitor.

Coefficient

A learned weight that controls how strongly a prepared input affects the weighted total.

Class balancing

Giving the two outcome groups balanced importance during learning so one class does not dominate simply because it has more rows.

Five-fold cross-validation

Split data into five parts. Train on four and test on the remaining part, repeat five times, then combine the test results. Every row is tested while outside its training fold.

Accuracy

The percentage of test examples assigned to the correct class at a 50% decision threshold. This project’s out-of-fold accuracy is 84.4%.

ROC AUC

A score of how well the model ranks presence examples above absence examples across all possible thresholds. 50% is chance-like; 100% is perfect on that test set. Here it is 89.9%.

Explainable AI (XAI)

Methods that help people inspect why a model produced a result instead of showing only an answer.

Bias

A systematic unfair or inaccurate tendency, often caused by incomplete, unbalanced, or unrepresentative data. “Bias” also has a separate mathematical meaning: the intercept in the equation.

Privacy

Protecting information about people. This app uses public de-identified training data and does not store visitor entries.

A fair test

How we check the model

ROUND 1TESTTRAINTRAINTRAINTRAIN
ROUND 2TRAINTESTTRAINTRAINTRAIN
ROUND 3TRAINTRAINTESTTRAINTRAIN
ROUND 4TRAINTRAINTRAINTESTTRAIN
ROUND 5TRAINTRAINTRAINTRAINTEST

Why not test on the same rows used for learning?
That would be like giving a student the answer sheet before an exam. A model could memorize details and appear better than it is.

Does 84.4% mean the model is medically ready?
No. It describes performance on this small historical dataset only. Clinical AI needs much larger, diverse, independently validated data and professional review.

Student access

Preparing for the exhibition?

The demonstration script and judge-question answers are now kept on a password-protected page.

Open exhibition prep

Sources

Where these explanations come from

External sources require internet access, but the medical and AI explanations are included on this page and in the printable project guide.