P2 Case Study
← Back to projects

AI-Powered Preventive
Heart Disease Risk Detection

Using CDC behavioral survey data and machine learning for early risk prediction — before symptoms appear.

50,000CDC Behavioral Survey Dataset
19Input Features
3ML Models
90.98%Best Accuracy
P2.1 The Problem

Healthcare is reactive, not preventive

Heart disease is the #1 cause of death globally. Symptoms typically appear only after serious damage is already done, and the current system waits for patients to get sick before acting. The goal here: detect risk before symptoms appear, using behavioral data already being collected.

P2.2 Workflow

RapidMiner pipeline

Built and trained entirely in RapidMiner Studio 12.1, on the CDC BRFSS dataset (via Kaggle) — real survey data from 50,000 Americans, not synthetic.

  1. 01

    Read & clean data

    Retrieve → select 19 attributes → average imputation for missing values.

  2. 02

    Normalize features

    Z-transformation across all numeric features · set HeartDiseaseorAttack as the label.

  3. 03

    Feature engineering

    Generated two composite features — Lifestyle Score and Health Burden Index (details below).

  4. 04

    Train 3 models

    10-fold cross-validation across Logistic Regression, Decision Tree (depth 5), and Random Forest (100 trees, depth 10).

RapidMiner process canvas showing the full pipeline: Retrieve, Select Attributes, Numerical to Binominal, Set Role, Replace Missing Values, Normalize, Lifestyle Score & Health Burden Index generation, Multiply, three parallel model branches (Logistic Regression, Decision Tree CV, Random Forest CV), Apply Model, GA for Risk Category, GA for Recommendation, and Write CSV output.
Full RapidMiner process canvas — data prep through model training to risk-tier output.
P2.3 Feature Engineering

Two engineered features

Lifestyle Score

(PhysActivity × 2) + Fruits + Veggies − Smoker − HvyAlcoholConsump

Health Burden Index

HighBP + HighChol + Diabetes + (GenHlth − 1) + DiffWalk

P2.4 Model Results

Models trained and compared

Random Forest was selected for deployment — highest AUC (0.824) indicates the best risk discrimination, even though Decision Tree edged it slightly on raw accuracy.

ModelAccuracyAUCNotes
Logistic Regression84.88%0.83410-fold CV
Decision Tree90.97%0.569Depth 5
Random Forest ★ Selected90.98%0.824100 trees, depth 10, 10-fold CV

The Random Forest model correctly classified 9 out of 10 patients, with an AUC of 0.824 demonstrating strong ability to distinguish risk vs. no-risk cases.

ROC curve for the Random Forest model, AUC 0.824 plus or minus 0.007, positive class true.
ROC curve — Random Forest, 10-fold cross-validation. AUC 0.824 ± 0.007.
P2.5 Output

Risk tiers & recommendations

Each patient in the output CSV receives a risk score, a tier, and a personalized recommendation for clinical follow-up.

0.0 – 0.3

Low Risk

0.3 – 0.6

Moderate Risk

0.6 – 0.8

High Risk

0.8 – 1.0

Critical Risk

Quarterly checkup, medication review, diet plan

Sample rows from the model output CSV showing actual vs. predicted HeartDiseaseorAttack, generated recommendation, risk category, HighBP value, and prediction confidence for each patient.
Sample rows from the output CSV — each patient gets a prediction, risk category, recommendation, and confidence score.
P2.6 Full Report

Read the complete writeup

Full report embedded below. If it doesn't load, use the button to open it directly in Google Drive.

P2.7 Next Steps

Conclusion & next steps

Trained 3 ML models on 50,000 CDC survey records, achieved 90.98% accuracy with Random Forest, and exported an actionable output with risk tiers and personalized recommendations for clinical use.

Next: validate on external datasets, deploy as an API for EHR integration, build a patient-facing web interface, and run a clinical pilot study.