This project predicts whether a customer is likely to churn from a bank using a machine learning model built with TensorFlow and deployed via Streamlit. The model is trained on customer profile data and financial metrics.
The dataset used is Churn_Modelling.csv and contains the following features:
CreditScoreGeographyGenderAgeTenureBalanceNumOfProductsHasCrCardIsActiveMemberEstimatedSalary
The target variable is Exited, indicating whether a customer has churned.
.
├── app.py # Streamlit app for churn prediction
├── streamlit\_regression.py # Streamlit app for salary regression (optional)
├── model.h5 # Trained churn prediction model
├── regression\_model.h5 # Trained regression model
├── scaler.pkl # StandardScaler for numerical features
├── lable\_encoder\_gender.pkl # LabelEncoder for Gender
├── one\_hot\_encoder\_geo.pkl # OneHotEncoder for Geography
├── requirements.txt # Python dependencies
├── runtime.txt # Runtime environment (for deployment)
├── hyperparameter\_tuning.ipynb # Notebook for tuning hyperparameters
├── predictions.ipynb # Model prediction and evaluation
├── salaryregression.ipynb # Regression model training
├── experiments.ipynb # Initial exploratory analysis
├── Churn\_Modelling.csv # Dataset
├── README.md # Project documentation
- Install dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app.pyThe app will launch in your browser where you can input customer details and see churn predictions.
-
Preprocessing
-
Encode categorical features:
Gender→ LabelEncodedGeography→ OneHotEncoded
-
Scale numerical features with
StandardScaler.
-
-
Model
- A deep learning classification model built using Keras.
- Output is a churn probability (between 0 and 1).
-
Prediction
- If the probability > 0.5 → Customer is likely to churn.
- Else → Customer is likely to stay.
-
Hyperparameter tuning notebooks are available for training custom models.
-
You can find:
hyperparameter_tuning.ipynb— tuning classification modelsalaryregression.ipynb— regression analysispredictions.ipynb— model inference and evaluation
requirements.txtandruntime.txtare included for deployment on platforms like Heroku or Streamlit Cloud.- For containerized deployment, a Dockerfile can be added if needed.