# didar-ali-deed/customer-churn-prediction-ml architecture

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

- Interactive diagram: https://gitdiagram.com/didar-ali-deed/customer-churn-prediction-ml
- Repository: https://github.com/didar-ali-deed/customer-churn-prediction-ml

## Overview

This is a local, teaching-oriented telecom churn prediction project. Its main workflow audits and cleans customer data, reserves a stratified holdout, explores training data, engineers fold-safe features, compares and tunes models, selects a cost-based threshold from training out-of-fold predictions, evaluates once on the holdout, and produces SHAP explanations and single-customer predictions. The README documents the ordered stages; source excerpts confirm several key data and module dependencies. Some implementation details are unsampled, so edges are limited to documented or evidenced relationships.

Main entry points: [`src/split.py`](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/split.py) (Stratified split), [`models`](https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/models) (Saved pipeline), [`data/raw`](https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/data/raw) (Raw Telco CSV), [`src/train.py`](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_raw["Raw Telco CSV"]
  node_audit["Data audit<br/>[data.py]"]
  node_clean["Data cleaning<br/>[data.py]"]
  node_clean_csv["Clean dataset<br/>[clean.csv]"]
  node_split["Stratified split<br/>[split.py]"]
end

subgraph group_analysis["Analysis and features"]
  node_eda["Training-only EDA<br/>[eda.py]"]
  node_features["Business features<br/>[features.py]"]
  node_preprocess["Fold-safe preprocessing<br/>[features.py]"]
end

subgraph group_modeling["Modeling and evaluation"]
  node_baseline["Baseline comparison<br/>[train.py]"]
  node_training["Model training<br/>[train.py]"]
  node_model[("Saved pipeline")]
  node_threshold["Threshold selection<br/>[evaluate.py]"]
  node_evaluation["Held-out evaluation<br/>[evaluate.py]"]
end

subgraph group_delivery["Interpretation and use"]
  node_explain["SHAP explanations<br/>[explain.py]"]
  node_inference["Customer prediction<br/>[predict.py]"]
  node_summary["Results summary<br/>[summary.py]"]
end

node_analyst(("Project user"))

node_analyst -->|"provides data"| node_raw
node_raw -->|"audits"| node_audit
node_raw -->|"cleans"| node_clean
node_clean -->|"writes"| node_clean_csv
node_clean_csv -->|"loads"| node_split
node_split -->|"supplies training rows"| node_eda
node_split -->|"supplies training rows"| node_features
node_split -->|"provides train split"| node_baseline
node_features -->|"builds"| node_preprocess
node_preprocess -->|"prepares pipeline"| node_training
node_training -.->|"saves"| node_model
node_training -->|"supplies model and OOF scores"| node_threshold
node_threshold -->|"locks cutoff before test"| node_evaluation
node_model -->|"predicts holdout"| node_evaluation
node_model -->|"explains frozen model"| node_explain
node_model -->|"scores customer"| node_inference
node_threshold -->|"provides cutoff"| node_inference
node_evaluation -->|"summarizes results"| node_summary
node_explain -.->|"summarizes findings"| node_summary
node_analyst -->|"runs workflow"| node_audit
node_analyst -.->|"requests score"| node_inference

click node_raw "https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/data/raw"
click node_audit "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/data.py"
click node_clean "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/data.py"
click node_clean_csv "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/data/processed/clean.csv"
click node_split "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/split.py"
click node_eda "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/eda.py"
click node_features "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/features.py"
click node_preprocess "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/features.py"
click node_baseline "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/train.py"
click node_training "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/train.py"
click node_model "https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/models"
click node_threshold "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/evaluate.py"
click node_evaluation "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/evaluate.py"
click node_explain "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/explain.py"
click node_inference "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/predict.py"
click node_summary "https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/summary.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_raw,node_audit,node_clean,node_clean_csv,node_split,node_analyst toneBlue
class node_eda,node_features,node_preprocess toneAmber
class node_baseline,node_training,node_model,node_threshold,node_evaluation toneMint
class node_explain,node_inference,node_summary toneRose
```

## Components

### Data preparation

- [Raw Telco CSV](https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/data/raw): `data/raw`
- [Data audit](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/data.py): `src/data.py`
- [Data cleaning](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/data.py): `src/data.py`
- [Clean dataset](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/data/processed/clean.csv): `data/processed/clean.csv`
- [Stratified split](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/split.py): `src/split.py`

### Analysis and features

- [Training-only EDA](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/eda.py): `src/eda.py`
- [Business features](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/features.py): `src/features.py`
- [Fold-safe preprocessing](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/features.py): `src/features.py`

### Modeling and evaluation

- [Baseline comparison](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/train.py): `src/train.py`
- [Model training](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/train.py): `src/train.py`
- [Saved pipeline](https://github.com/didar-ali-deed/customer-churn-prediction-ml/tree/main/models): `models`
- [Threshold selection](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/evaluate.py): `src/evaluate.py`
- [Held-out evaluation](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/evaluate.py): `src/evaluate.py`

### Interpretation and use

- [SHAP explanations](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/explain.py): `src/explain.py`
- [Customer prediction](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/predict.py): `src/predict.py`
- [Results summary](https://github.com/didar-ali-deed/customer-churn-prediction-ml/blob/main/src/summary.py): `src/summary.py`

### Other components

- **Project user**

## Connections

- Project user → Raw Telco CSV: provides data (evidence: `README.md`)
- Raw Telco CSV → Data audit: audits (evidence: `src/data.py`)
- Raw Telco CSV → Data cleaning: cleans (evidence: `src/data.py`)
- Data cleaning → Clean dataset: writes (evidence: `src/data.py`)
- Clean dataset → Stratified split: loads (evidence: `src/split.py`)
- Stratified split → Training-only EDA: supplies training rows (evidence: `src/eda.py`)
- Stratified split → Business features: supplies training rows (evidence: `src/features.py`)
- Stratified split → Baseline comparison: provides train split (evidence: `src/train.py`)
- Business features → Fold-safe preprocessing: builds (evidence: `src/features.py`)
- Fold-safe preprocessing → Model training: prepares pipeline (evidence: `src/features.py`)
- Model training → Saved pipeline: saves
- Model training → Threshold selection: supplies model and OOF scores (evidence: `src/evaluate.py`)
- Threshold selection → Held-out evaluation: locks cutoff before test (evidence: `src/evaluate.py`)
- Saved pipeline → Held-out evaluation: predicts holdout (evidence: `src/evaluate.py`)
- Saved pipeline → SHAP explanations: explains frozen model (evidence: `src/explain.py`)
- Saved pipeline → Customer prediction: scores customer (evidence: `src/predict.py`)
- Threshold selection → Customer prediction: provides cutoff (evidence: `src/predict.py`)
- Held-out evaluation → Results summary: summarizes results (evidence: `src/summary.py`)
- SHAP explanations → Results summary: summarizes findings
- Project user → Data audit: runs workflow (evidence: `README.md`)
- Project user → Customer prediction: requests score
