Heart Disease Classification (Gradient Boosting Pipeline)
This repository contains a serialized scikit-learn Gradient Boosting model pipeline (heart_disease_gb_pipeline.joblib) for predicting the presence of cardiovascular disease based on clinical features.
- Peak Benchmark Accuracy: 88.33%
- Test Set Accuracy: 86.67%
- Framework:
scikit-learn,joblib - Feature Set: 13 clinical indicators (age, sex, chest pain type, blood pressure, cholesterol, max heart rate, etc.)
Model Usage
import joblib
import pandas as pd
from huggingface_hub import hf_hub_download
# Download the serialized pipeline
model_path = hf_hub_download(repo_id="Vecrist/heart-disease-gb-pipeline", filename="heart_disease_gb_pipeline.joblib")
pipeline = joblib.load(model_path)
# Sample Patient Data
sample_data = {
"ca": [0],
"thalach": [150],
"oldpeak": [1.5],
"exang": [0],
"sex": [1],
"age": [55],
"cp_2.0": [0],
"cp_3.0": [1],
"cp_4.0": [0],
"thal_6.0": [0],
"thal_7.0": [1],
"slope_2.0": [1],
"slope_3.0": [0]
}
sample_df = pd.DataFrame(sample_data)
# Predict (0 = Heart Disease Absent, 1 = Heart Disease Present)
prediction = pipeline.predict(sample_df)
print("Prediction:", prediction[0])
Clinical Features
The model processes 13 clinical metrics:
age: Patient age in years.sex: Biological sex (1 = male, 0 = female).cp: Chest pain type (one-hot encoded).trestbps: Resting blood pressure in mm Hg.chol: Serum cholesterol in mg/dl.fbs: Fasting blood sugar (>120 mg/dl).restecg: Resting electrocardiographic results.thalach: Maximum heart rate achieved during stress testing.exang: Exercise-induced angina.oldpeak: ST depression induced by exercise relative to rest.slope: Peak exercise ST segment slope.ca: Number of major vessels (0 to 3) colored by fluoroscopy.thal: Thalassemia category.