CoolFace
Modelpublic

abdalla732/heart_failure_prediction

sourceHugging Facemitupdated 14d agoView on Hugging Face
1likes47downloads
Model Card

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

FilePurpose
heart_model.kerasTrained Keras model
scaler.joblibStandardScaler fitted on training data
feature_columns.joblibColumn 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

python
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})")