🏦 Bank Customer Churn Prediction (ANN | Keras)
A lightweight Keras ANN for bank customer churn prediction (Exited: 0 = stay, 1 = churn).
This Hugging Face repo hosts the trained model plus preprocessing artifacts used by a Streamlit inference app.
Training → Model → Inference
- Training notebook (Colab): https://colab.research.google.com/drive/1ubzL_5BlJwnAVtqoko7IlZjYa0V8913r
- Inference app (Streamlit): https://github.com/sparklerz/Deep-Learning-Fundamentals-Suite
(usespages/01_Bank_Churn_Prediction.py)
What’s in this repo
artifacts/model.h5(Keras model)artifacts/scaler.pkl(StandardScaler)artifacts/label_encoder_gender.pkl(LabelEncoder for Gender)artifacts/onehot_encoder_geo.pkl(OneHotEncoder for Geography)artifacts/schema.json(feature order + mappings)Churn_Modelling.csv(dataset copy used in training)
Inputs (feature order)
The model expects 12 features in this exact order (see artifacts/schema.json):
CreditScore, Gender, Age, Tenure, Balance, NumOfProducts, HasCrCard, IsActiveMember, EstimatedSalary, Geography_France, Geography_Germany, Geography_Spain
Preprocessing (same as training/inference app):
Gender: label-encoded (Female: 0,Male: 1)Geography: one-hot encoded into the 3 geography columns- All final features are scaled using
StandardScaler(fromscaler.pkl)
Output
- Returns a churn probability in
[0, 1]. schema.jsonstores a default decision threshold of 0.5. (The Streamlit demo app uses 0.35 by default to be more sensitive to churn.)
Quickstart (load artifacts)
import tensorflow as tf, pickle, json
from huggingface_hub import hf_hub_download
REPO_ID = "ash001/bank-churn-ann"
model = tf.keras.models.load_model(hf_hub_download(REPO_ID, "artifacts/model.h5"), compile=False)
scaler = pickle.load(open(hf_hub_download(REPO_ID, "artifacts/scaler.pkl"), "rb"))
le_gender = pickle.load(open(hf_hub_download(REPO_ID, "artifacts/label_encoder_gender.pkl"), "rb"))
ohe_geo = pickle.load(open(hf_hub_download(REPO_ID, "artifacts/onehot_encoder_geo.pkl"), "rb"))
schema = json.load(open(hf_hub_download(REPO_ID, "artifacts/schema.json"), "r"))
For an end-to-end preprocessing + prediction example, refer to the Streamlit inference file: pages/01_Bank_Churn_Prediction.py.
Notes / limitations
- Intended for learning/demo; may not generalize to other banks/time periods without retraining and monitoring.
- Contains
.pklartifacts—only unpickle files you trust.
license: apache-2.0
- Downloads last month
- -