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.
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.
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.
Tested on 1,178 records the model hadn’t trained on.
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.
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.
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.