# madhavkumaryadav/customer-churn-prediction-with-ann- architecture

> Architecture diagram of the GitHub repository madhavkumaryadav/customer-churn-prediction-with-ann-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madhavkumaryadav/customer-churn-prediction-with-ann-
- Repository: https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-

## Overview

This repository serves bank-customer churn predictions through Streamlit: users enter profile and account details, the app reuses saved preprocessing artifacts, and a trained ANN produces a churn probability and verdict. The README also describes risk levels and a gauge; the sampled `app.py` shows a simpler probability-and-verdict display, while `update_ui.py` contains excerpts of the richer interface. Training internals are not sampled, so the graph treats the model and preprocessing files as supplied artifacts.

Main entry points: [`app.py`](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py) (Streamlit app), [`model.h5`](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/model.h5) (Churn ANN), [`update_ui.py`](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/update_ui.py) (Enhanced UI), [`Churn_Modelling.csv`](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/Churn_Modelling.csv) (Customer dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_basic_app["Streamlit app<br/>[app.py]"]
  node_enhanced_app["Enhanced UI<br/>[update_ui.py]"]
  node_risk_result["Risk and verdict<br/>[update_ui.py]"]
end

subgraph group_inference["Inference pipeline"]
  node_features["Customer inputs<br/>[app.py]"]
  node_gender_encode["Gender encoding<br/>[app.py]"]
  node_geo_encode["Geography encoding<br/>[app.py]"]
  node_feature_merge["Feature assembly<br/>[app.py]"]
  node_scaling["Feature scaling<br/>[app.py]"]
  node_probability["Churn probability<br/>[app.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_ann["Churn ANN<br/>[model.h5]"]
  node_gender_artifact["Gender encoder"]
  node_geo_artifact["Geography encoder<br/>[geo_encoder.pkl]"]
  node_scale_artifact["Fitted scaler<br/>[scaler.pkl]"]
end

subgraph group_data["Training data"]
  node_dataset["Customer dataset"]
  node_exploration["Data exploration<br/>[Explore_data.ipynb]"]
  node_prediction_notebook["Prediction notebook<br/>[prediction.ipynb]"]
end

node_user(("Bank staff"))

node_user -->|"enters details"| node_basic_app
node_user -.->|"enters details"| node_enhanced_app
node_basic_app -->|"collects"| node_features
node_enhanced_app -.->|"collects"| node_features
node_basic_app -->|"loads"| node_gender_artifact
node_basic_app -->|"loads"| node_geo_artifact
node_basic_app -->|"loads"| node_scale_artifact
node_basic_app -->|"loads"| node_ann
node_features -->|"encodes gender"| node_gender_encode
node_features -->|"encodes geography"| node_geo_encode
node_gender_encode -->|"provides feature"| node_feature_merge
node_geo_encode -->|"provides features"| node_feature_merge
node_feature_merge -->|"scales features"| node_scaling
node_scaling -->|"supplies input"| node_ann
node_ann -->|"returns probability"| node_probability
node_probability -->|"displays result"| node_basic_app
node_probability -.->|"formats risk result"| node_risk_result
node_dataset -.->|"explored in"| node_exploration

click node_basic_app "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_enhanced_app "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/update_ui.py"
click node_features "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_gender_encode "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_geo_encode "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_feature_merge "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_scaling "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_ann "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/model.h5"
click node_gender_artifact "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/level_encoder_gender.pkl"
click node_geo_artifact "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/geo_encoder.pkl"
click node_scale_artifact "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/scaler.pkl"
click node_probability "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py"
click node_risk_result "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/update_ui.py"
click node_dataset "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/Churn_Modelling.csv"
click node_exploration "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/Explore_data.ipynb"
click node_prediction_notebook "https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/prediction.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_basic_app,node_enhanced_app,node_risk_result toneBlue
class node_features,node_gender_encode,node_geo_encode,node_feature_merge,node_scaling,node_probability toneAmber
class node_ann,node_gender_artifact,node_geo_artifact,node_scale_artifact toneMint
class node_dataset,node_exploration,node_prediction_notebook toneRose
class node_user toneIndigo
```

## Components

### User interfaces

- [Streamlit app](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Enhanced UI](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/update_ui.py): `update_ui.py`
- [Risk and verdict](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/update_ui.py): `update_ui.py`

### Inference pipeline

- [Customer inputs](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Gender encoding](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Geography encoding](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Feature assembly](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Feature scaling](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`
- [Churn probability](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/app.py): `app.py`

### Model artifacts

- [Churn ANN](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/model.h5): `model.h5`
- [Gender encoder](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/level_encoder_gender.pkl): `level_encoder_gender.pkl`
- [Geography encoder](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/geo_encoder.pkl): `geo_encoder.pkl`
- [Fitted scaler](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/scaler.pkl): `scaler.pkl`

### Training data

- [Customer dataset](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/Churn_Modelling.csv): `Churn_Modelling.csv`
- [Data exploration](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/Explore_data.ipynb): `Explore_data.ipynb`
- [Prediction notebook](https://github.com/madhavkumaryadav/customer-churn-prediction-with-ann-/blob/main/prediction.ipynb): `prediction.ipynb`

### Other components

- **Bank staff**

## Connections

- Bank staff → Streamlit app: enters details
- Bank staff → Enhanced UI: enters details
- Streamlit app → Customer inputs: collects
- Enhanced UI → Customer inputs: collects
- Streamlit app → Gender encoder: loads
- Streamlit app → Geography encoder: loads
- Streamlit app → Fitted scaler: loads
- Streamlit app → Churn ANN: loads
- Customer inputs → Gender encoding: encodes gender
- Customer inputs → Geography encoding: encodes geography
- Gender encoding → Feature assembly: provides feature
- Geography encoding → Feature assembly: provides features
- Feature assembly → Feature scaling: scales features
- Feature scaling → Churn ANN: supplies input
- Churn ANN → Churn probability: returns probability
- Churn probability → Streamlit app: displays result
- Churn probability → Risk and verdict: formats risk result
- Customer dataset → Data exploration: explored in
