Instructions to use abdalla732/heart_failure_prediction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use abdalla732/heart_failure_prediction with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://abdalla732/heart_failure_prediction") - Notebooks
- Google Colab
- Kaggle
Heart Failure Prediction β Keras Model
A Keras / TensorFlow neural network that predicts the presence of heart disease in patients using 11 clinical and demographic features.
Model Details
- Developed by: Abdallah Ahmed
- Model type: Binary classification (tabular data)
- Framework: Keras 3 / TensorFlow 2.x
- Format:
.keras - License: MIT
Files in this Repo
| File | Purpose |
|---|---|
heart_model.keras |
Trained Keras model |
scaler.joblib |
StandardScaler fitted on training data |
feature_columns.joblib |
Column names after one-hot encoding |
Uses
Direct Use
Educational and research purposes only. Explore how clinical features relate to heart disease risk.
Out-of-Scope Use
- β Not a medical device. Do not use for real clinical decisions.
- β Not validated on real-world hospital populations.
How to Get Started
from huggingface_hub import hf_hub_download
import joblib
import pandas as pd
from tensorflow import keras
# Download model + preprocessing artifacts
model_path = hf_hub_download("abdalla732/heart_failure_prediction", "heart_model.keras")
scaler_path = hf_hub_download("abdalla732/heart_failure_prediction", "scaler.joblib")
cols_path = hf_hub_download("abdalla732/heart_failure_prediction", "feature_columns.joblib")
# Load
model = keras.models.load_model(model_path)
scaler = joblib.load(scaler_path)
columns = joblib.load(cols_path)
# Prepare a sample input
raw = pd.DataFrame([{
"Age": 54, "Sex": "M", "ChestPainType": "NAP", "RestingBP": 150,
"Cholesterol": 195, "FastingBS": 0, "RestingECG": "Normal",
"MaxHR": 122, "ExerciseAngina": "N", "Oldpeak": 0.0, "ST_Slope": "Up"
}])
raw = pd.get_dummies(raw, drop_first=False)
raw = raw.reindex(columns=columns, fill_value=0)
X = scaler.transform(raw.values.astype("float32"))
# Predict
prob = float(model.predict(X, verbose=0)[0][0])
print("Heart disease" if prob > 0.5 else "No heart disease", f"(p = {prob:.3f})")
- Downloads last month
- 36