# rohithbhagath/crm-churn-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/rohithbhagath/crm-churn-prediction
- Repository: https://github.com/rohithbhagath/crm-churn-prediction

## Overview

This repository is a Telco-customer churn analysis and Streamlit dashboard project. Its main user workflow is entering customer attributes in the dashboard and viewing a churn prediction, probability, risk level, and recommended action; the dashboard also presents portfolio analysis and risk segments. The README documents a separate notebook-based preparation, modeling, evaluation, and segmentation workflow, though the notebook excerpts were not available. Dashboard-to-artifact relationships are documented in the README; the app excerpt directly shows scaling inputs and invoking classifier prediction.

Main entry points: [`app.py`](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py) (Streamlit dashboard), [`segmented_churn_data.csv`](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/segmented_churn_data.csv) (Segmented customer data), [`ModelBuilding.ipynb`](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/ModelBuilding.ipynb) (Classifier training), [`RiskSegmentation.ipynb`](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/RiskSegmentation.ipynb) (Risk segmentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Data analysis"]
  node_eda["Exploratory analysis<br/>[EDA.ipynb]"]
  node_feature_engineering["Feature engineering"]
end

subgraph group_modeling["Model development"]
  node_model_building["Classifier training"]
  node_risk_segmentation["Risk segmentation"]
end

subgraph group_dashboard["CRM dashboard"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_portfolio_views["Overview and analysis<br/>[app.py]"]
  node_segment_views["Segment profiles<br/>[app.py]"]
  node_prediction_form["Prediction form<br/>[app.py]"]
  node_prediction_result["Prediction and guidance<br/>[app.py]"]
end

subgraph group_artifacts["Data and models"]
  node_dataset[("Segmented customer data")]
  node_classifier["Churn classifier"]
  node_scaler["Feature scaler<br/>[scaler.pkl]"]
  node_kmeans["K-Means model<br/>[kmeans_model.pkl]"]
end

node_analyst(("Analyst"))
node_crm_user(("CRM user"))

node_analyst -.->|"develops features"| node_feature_engineering
node_feature_engineering -.->|"supports analysis"| node_eda
node_eda -.->|"informs training"| node_model_building
node_model_building -.->|"precedes segmentation"| node_risk_segmentation
node_risk_segmentation -.->|"produces segments"| node_dataset
node_model_building -.->|"exports model"| node_classifier
node_risk_segmentation -.->|"exports clusterer"| node_kmeans
node_crm_user -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_portfolio_views
node_dashboard -->|"renders"| node_segment_views
node_dashboard -->|"renders"| node_prediction_form
node_prediction_form -->|"transforms input"| node_scaler
node_prediction_form -->|"predicts churn"| node_classifier
node_prediction_form -->|"displays result"| node_prediction_result
node_dataset -.->|"supplies dashboard data"| node_portfolio_views
node_dataset -.->|"supplies segments"| node_segment_views
node_kmeans -.->|"assigns segments"| node_dataset

click node_eda "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/EDA.ipynb"
click node_feature_engineering "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/FeatureEngineerimg.ipynb"
click node_model_building "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/ModelBuilding.ipynb"
click node_risk_segmentation "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/RiskSegmentation.ipynb"
click node_dataset "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/segmented_churn_data.csv"
click node_classifier "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/best_churn_model.pkl"
click node_scaler "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/scaler.pkl"
click node_kmeans "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/kmeans_model.pkl"
click node_dashboard "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py"
click node_portfolio_views "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py"
click node_segment_views "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py"
click node_prediction_form "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py"
click node_prediction_result "https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py"

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_eda,node_feature_engineering,node_crm_user toneBlue
class node_model_building,node_risk_segmentation toneAmber
class node_dashboard,node_portfolio_views,node_segment_views,node_prediction_form,node_prediction_result toneMint
class node_dataset,node_classifier,node_scaler,node_kmeans toneRose
class node_analyst toneIndigo
```

## Components

### Data analysis

- [Exploratory analysis](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/EDA.ipynb): `EDA.ipynb`
- [Feature engineering](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/FeatureEngineerimg.ipynb): `FeatureEngineerimg.ipynb`

### Model development

- [Classifier training](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/ModelBuilding.ipynb): `ModelBuilding.ipynb`
- [Risk segmentation](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/RiskSegmentation.ipynb): `RiskSegmentation.ipynb`

### CRM dashboard

- [Streamlit dashboard](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py): `app.py`
- [Overview and analysis](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py): `app.py`
- [Segment profiles](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py): `app.py`
- [Prediction form](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py): `app.py`
- [Prediction and guidance](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/app.py): `app.py`

### Data and models

- [Segmented customer data](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/segmented_churn_data.csv): `segmented_churn_data.csv`
- [Churn classifier](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/best_churn_model.pkl): `best_churn_model.pkl`
- [Feature scaler](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/scaler.pkl): `scaler.pkl`
- [K-Means model](https://github.com/rohithbhagath/crm-churn-prediction/blob/main/kmeans_model.pkl): `kmeans_model.pkl`

### Other components

- **Analyst**
- **CRM user**

## Connections

- Analyst → Feature engineering: develops features (evidence: `README.md`)
- Feature engineering → Exploratory analysis: supports analysis (evidence: `README.md`)
- Exploratory analysis → Classifier training: informs training (evidence: `README.md`)
- Classifier training → Risk segmentation: precedes segmentation (evidence: `README.md`)
- Risk segmentation → Segmented customer data: produces segments (evidence: `README.md`)
- Classifier training → Churn classifier: exports model (evidence: `README.md`)
- Risk segmentation → K-Means model: exports clusterer (evidence: `README.md`)
- CRM user → Streamlit dashboard: uses (evidence: `README.md`)
- Streamlit dashboard → Overview and analysis: renders (evidence: `app.py`)
- Streamlit dashboard → Segment profiles: renders (evidence: `app.py`)
- Streamlit dashboard → Prediction form: renders (evidence: `app.py`)
- Prediction form → Feature scaler: transforms input (evidence: `app.py`)
- Prediction form → Churn classifier: predicts churn (evidence: `app.py`)
- Prediction form → Prediction and guidance: displays result (evidence: `app.py`)
- Segmented customer data → Overview and analysis: supplies dashboard data (evidence: `README.md`)
- Segmented customer data → Segment profiles: supplies segments (evidence: `README.md`)
- K-Means model → Segmented customer data: assigns segments (evidence: `README.md`)
