Downloads · 30 days
11
38% of all-time downloads
nexusbert/heart-disease-random-forest
heart-disease-random-forest is a tabular classification model from nexusbert. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. It is set up for scikit-learn.
A controlled Random Forest classifier for binary heart disease classification using seven selected and preprocessed features.
Downloads · 30 days
11
38% of all-time downloads
All-time downloads
29
Public
Repo size
2.3 MB
Likes
0
Public
Click a slice to open those files.
.joblib2.3 MB · 100%
From the Hugging Face model README
A controlled Random Forest classifier for binary heart disease classification using seven selected and preprocessed features.
This model was developed as part of a comparative machine learning research project evaluating traditional machine learning and neural-network approaches for tabular heart disease classification.
The model is a RandomForestClassifier implemented using scikit-learn.
The controlled configuration was selected to reduce unnecessary model complexity while maintaining strong predictive performance.
Binary classification:
0 — No Heart Disease1 — Heart DiseaseThe model expects seven features in exactly this order:
| Index | Feature |
|---|---|
| 0 | Age |
| 1 | Resting Blood Pressure |
| 2 | Cholesterol |
| 3 | Fasting Blood Sugar |
| 4 | Oldpeak |
| 5 | Exercise Angina: No |
| 6 | Exercise Angina: Yes |
The features must be supplied in the same preprocessed representation used during training.
n_estimators = 300
max_depth = 6
min_samples_split = 20
min_samples_leaf = 10
max_features = sqrt
class_weight = balanced
random_state = 42
n_jobs = -1
The dataset used for the experiment was divided into:
| Split | Samples |
|---|---|
| Training | 38,427 |
| Validation | 8,235 |
| Test | 8,235 |
The validation and test sets were kept separate from model training.
The controlled Random Forest achieved:
| Metric | Score |
|---|---|
| Accuracy | 1.0000 |
| Precision | 1.0000 |
| Recall | 1.0000 |
| F1 Score | 1.0000 |
| ROC-AUC | 1.0000 |
| PR-AUC | 1.0000 |
The final held-out test performance was:
| Metric | Score |
|---|---|
| Accuracy | 0.9999 |
| Precision | 1.0000 |
| Recall | 0.9998 |
| F1 Score | 0.9999 |
| ROC-AUC | 1.0000 |
| PR-AUC | 1.0000 |
These results correspond to the experimental test split described above.
heart-disease-random-forest/
├── README.md
├── config.json
├── metrics.json
├── model.joblib
├── inference.py
└── requirements.txt
model.joblibContains the trained Random Forest model.
config.jsonContains model configuration and metadata required by the inference implementation.
metrics.jsonContains recorded evaluation metrics.
inference.pyProvides the inference interface for making predictions.
requirements.txtContains the Python dependencies required to run the model.
Clone or download this repository and install the dependencies:
pip install -r requirements.txt
The repository includes an inference.py module for prediction.
Example:
from inference import predict
features = [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0
]
result = predict(features)
print(result)
The seven values must correspond to the model's expected feature order.
A prediction may contain information similar to:
{
"prediction": 1,
"label": "Heart Disease",
"probability": 0.97
}
The probability is model-generated and depends on the supplied input.
this model expects the seven features in the preprocessed representation used during training. Raw clinical measurements should not be passed directly to the model unless they have first undergone the same preprocessing procedure used during model development.
For example, a raw value such as:
Age = 56
may not correspond directly to the numerical representation expected by the trained model.
For reproducible inference, the original preprocessing procedure should be applied before generating predictions.
The two exercise-angina features are represented using one-hot encoding:
Exercise Angina: NoExercise Angina: YesTherefore, the model expects both corresponding feature positions.
Example:
No -> [1, 0]Yes -> [0, 1]The complete feature vector therefore contains seven values.
This model is intended for:
This model is a research and educational machine learning system.
It is not a medical diagnostic device and should not be used to diagnose, treat, prevent, or make clinical decisions about an individual.
The reported performance was obtained on the dataset and experimental split used during development. Performance on external or real-world clinical populations may differ substantially.
Predictions from machine learning models should not be interpreted as medical diagnoses.
Any real-world healthcare application would require appropriate clinical validation, external testing, monitoring, regulatory review, and involvement of qualified healthcare professionals.
The model uses:
random_state = 42
to provide deterministic Random Forest behavior under the same software and data conditions.
Reproducing the reported metrics also requires using the same dataset, preprocessing procedure, feature selection procedure, and train/validation/test split.
Developed as part of a heart disease machine learning research project.