Views
No views yet
0 → No Heart Disease1 → Heart Disease Detected| 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 |
heart_disease_xgb.pkl1import joblib
2
3model = joblib.load("heart_disease_xgb.pkl")1import pandas as pd
2import joblib
3
4model = joblib.load("heart_disease_xgb.pkl")
5
6sample = pd.DataFrame([{
7 "age": 52,
8 "sex": 0,
9 "cp": 2,
10 "trestbps": 136,
11 "chol": 196,
12 "fbs": 0,
13 "restecg": 0,
14 "thalach": 169,
15 "exang": 0,
16 "oldpeak": 0.1,
17 "slope": 1,
18 "ca": 0,
19 "thal": 2
20}])
21
22prediction = model.predict(sample)
23probability = model.predict_proba(sample)
24
25print("Prediction:", prediction[0])
26print("Probability:", probability)1xgboost
2pandas
3numpy
4scikit-learn
5joblibpip install xgboost pandas numpy scikit-learn joblib