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:

  1. age: Patient age in years.
  2. sex: Biological sex (1 = male, 0 = female).
  3. cp: Chest pain type (one-hot encoded).
  4. trestbps: Resting blood pressure in mm Hg.
  5. chol: Serum cholesterol in mg/dl.
  6. fbs: Fasting blood sugar (>120 mg/dl).
  7. restecg: Resting electrocardiographic results.
  8. thalach: Maximum heart rate achieved during stress testing.
  9. exang: Exercise-induced angina.
  10. oldpeak: ST depression induced by exercise relative to rest.
  11. slope: Peak exercise ST segment slope.
  12. ca: Number of major vessels (0 to 3) colored by fluoroscopy.
  13. thal: Thalassemia category.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support