Machine Learning  ·  Clinical Classification  ·  University of Delaware

Can a computer spot heart failure?

I tested seven computer models to see how well they could sort patient records by heart failure outcome. Here’s what worked, what didn’t, and why the mistakes matter.

Python scikit-learn Pandas NumPy Predictive Modeling Clinical Data
5,888
Patient Records
Clinical Dataset
7
Models Compared
Seven ways to learn from data
95.3%
Best Accuracy
Deep Neural Network
12
Clinical Features
Heart measurements & blood tests

What I wanted to know

Heart failure means the heart isn’t pumping blood as well as it should. This project asks whether patterns in patient records can help a computer recognize it.

I compared seven models: programs that learn patterns from examples. I wanted to know which got the most answers right, and which made its reasoning easier to explore.

The data: 5,888 records and 12 measurements, including heart pumping strength and blood tests. I used 80% of the records for learning and saved 20% for testing.

Model Comparison

Which model got the most right?

The neural network, a model that learns layers of patterns, had the highest accuracy. Random Forest, which combines many decision trees, was close behind and lets us see which measurements mattered most overall.

Right answers & wrong turns

Deep Neural Network

Tested on 1,178 records the model hadn’t trained on.

Predicted
Healthy
Predicted
CHF
Actual
451
True Negative
20
False Positive
35
False Negative
672
True Positive

The score, and the misses

The best model got 1,123 of 1,178 answers right. It missed 35 records labeled with heart failure and flagged 20 records labeled without it.

It caught 672 of the 707 heart failure cases in the test data. That’s 95.0%. A high score still leaves mistakes worth examining.

95.3%
Accuracy
97.1%
Precision · flagged cases that were correct
95.0%
Recall · heart failure cases caught

The tradeoff: Random Forest scored 93.7%, versus 95.3% for the neural network. Its measurement rankings offer clues about its behavior, but don’t explain every individual prediction.

Feature Analysis

Which clues mattered?

Heart pumping strength and a blood test linked to kidney function ranked highest. Follow-up time also mattered. Before using a model for early prediction, I’d check whether it relies on information only available later.

Key Takeaways

01
A top score isn’t everything
The neural network scored highest. Random Forest was close and offered more clues about which measurements it used.
02
Useful clues need a closer look
Heart and kidney measurements ranked highest. That’s worth exploring, but a ranking alone doesn’t prove a model is reliable.
03
Count the mistakes, too
The best model still missed 35 cases. These project results need more checking before anyone considers real-world use.