Heart Disease Prediction Model (XGBoost)
Overview
This repository contains a trained XGBoost classification model for predicting the likelihood of heart disease based on patient clinical information.
...
Heart Disease Prediction Model (XGBoost)
Overview
This repository contains a trained XGBoost classification model for predicting the likelihood of heart disease based on patient clinical information.
The model was trained using a heart disease dataset containing demographic, clinical, and diagnostic features commonly used in cardiovascular risk assessment.
Model Information
Algorithm: XGBoost Classifier
Task: Binary Classification
Target Variable: Heart Disease Presence
0โ No Heart Disease1โ Heart Disease Detected
Input Features
The model expects the following 13 features:
| Feature | Description |
|---|---|
| age | Age of the patient |
| sex | Gender (0 = Female, 1 = Male) |
| cp | Chest Pain Type |
| trestbps | Resting Blood Pressure |
| chol | Serum Cholesterol |
| fbs | Fasting Blood Sugar (>120 mg/dl) |
| restecg | Resting Electrocardiographic Results |
| thalach | Maximum Heart Rate Achieved |
| exang | Exercise-Induced Angina |
| oldpeak | ST Depression Induced by Exercise |
| slope | Slope of Peak Exercise ST Segment |
| ca | Number of Major Vessels Colored by Fluoroscopy |
| thal | Thalassemia Status |
Model File
heart_disease_xgb.pkl
This file contains the trained XGBoost model serialized using Joblib.
Loading the Model
import joblib
model = joblib.load("heart_disease_xgb.pkl")
Example Prediction
import pandas as pd
import joblib
model = joblib.load("heart_disease_xgb.pkl")
sample = pd.DataFrame([{
"age": 52,
"sex": 0,
"cp": 2,
"trestbps": 136,
"chol": 196,
"fbs": 0,
"restecg": 0,
"thalach": 169,
"exang": 0,
"oldpeak": 0.1,
"slope": 1,
"ca": 0,
"thal": 2
}])
prediction = model.predict(sample)
probability = model.predict_proba(sample)
print("Prediction:", prediction[0])
print("Probability:", probability)
Dependencies
xgboost
pandas
numpy
scikit-learn
joblib
Install requirements:
pip install xgboost pandas numpy scikit-learn joblib
Intended Use
This model is intended for:
- Educational projects
- Machine Learning demonstrations
- Healthcare analytics research
- Streamlit and Hugging Face deployments
Disclaimer
This model is designed for educational and research purposes only. Predictions should not be considered medical advice or used for clinical decision-making without professional medical evaluation.