# riyadhami13/customer-churn-prediction-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/riyadhami13/customer-churn-prediction-pipeline
- Repository: https://github.com/riyadhami13/customer-churn-prediction-pipeline

## Overview

This repository is a banking-customer churn analysis, documented through its README and represented by a notebook, a CSV, and a SQLite database. The documented workflow extracts a high-balance inactive-account cohort, evaluates logistic regression and random-forest models, compares score thresholds, and summarizes customers into risk tiers to inform retention decisions. The README documents these stages and results, but no notebook source was available, so internal calls and the roles of the two data files beyond the documented SQL extraction are not asserted.

Main entry points: [`Churn.ipynb`](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb) (Random forest), [`churn_banking.db`](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/churn_banking.db) (Banking database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Customer data"]
  node_database[("Banking database<br/>[churn_banking.db]")]
  node_csv["Customer CSV"]
  node_cohort["Cohort extraction<br/>[Churn.ipynb]"]
end

subgraph group_modeling["Churn modeling"]
  node_analysis["Churn notebook<br/>[Churn.ipynb]"]
  node_split["Train-test split<br/>[Churn.ipynb]"]
  node_logistic["Logistic baseline<br/>[Churn.ipynb]"]
  node_forest["Random forest<br/>[Churn.ipynb]"]
  node_evaluation["Model evaluation<br/>[Churn.ipynb]"]
end

subgraph group_decisions["Retention decisions"]
  node_thresholds["Threshold tradeoff<br/>[Churn.ipynb]"]
  node_tiers["Risk tiers<br/>[Churn.ipynb]"]
  node_recommendation["Retention recommendation<br/>[Churn.ipynb]"]
end

node_analyst(("Analyst"))

node_database -->|"SQL extraction"| node_cohort
node_analysis -->|"documents workflow"| node_cohort
node_cohort -->|"80/20 split"| node_split
node_split -->|"fits baseline"| node_logistic
node_split -->|"fits model"| node_forest
node_logistic -->|"reports metrics"| node_evaluation
node_forest -->|"reports metrics"| node_evaluation
node_forest -->|"scores thresholds"| node_thresholds
node_forest -->|"scores customers"| node_tiers
node_thresholds -->|"informs cutoff"| node_recommendation
node_tiers -->|"informs targeting"| node_recommendation

click node_database "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/churn_banking.db"
click node_csv "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn_Modelling.csv"
click node_analysis "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_cohort "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_split "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_logistic "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_forest "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_evaluation "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_thresholds "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_tiers "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb"
click node_recommendation "https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.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_database,node_csv,node_cohort toneBlue
class node_analysis,node_split,node_logistic,node_forest,node_evaluation toneAmber
class node_thresholds,node_tiers,node_recommendation toneMint
class node_analyst toneIndigo
```

## Components

### Customer data

- [Banking database](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/churn_banking.db): `churn_banking.db`
- [Customer CSV](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn_Modelling.csv): `Churn_Modelling.csv`
- [Cohort extraction](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`

### Churn modeling

- [Churn notebook](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Train-test split](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Logistic baseline](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Random forest](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Model evaluation](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`

### Retention decisions

- [Threshold tradeoff](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Risk tiers](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`
- [Retention recommendation](https://github.com/riyadhami13/customer-churn-prediction-pipeline/blob/main/Churn.ipynb): `Churn.ipynb`

### Other components

- **Analyst**

## Connections

- Banking database → Cohort extraction: SQL extraction (evidence: `README.md`)
- Churn notebook → Cohort extraction: documents workflow (evidence: `README.md`)
- Cohort extraction → Train-test split: 80/20 split (evidence: `README.md`)
- Train-test split → Logistic baseline: fits baseline (evidence: `README.md`)
- Train-test split → Random forest: fits model (evidence: `README.md`)
- Logistic baseline → Model evaluation: reports metrics (evidence: `README.md`)
- Random forest → Model evaluation: reports metrics (evidence: `README.md`)
- Random forest → Threshold tradeoff: scores thresholds (evidence: `README.md`)
- Random forest → Risk tiers: scores customers (evidence: `README.md`)
- Threshold tradeoff → Retention recommendation: informs cutoff (evidence: `README.md`)
- Risk tiers → Retention recommendation: informs targeting (evidence: `README.md`)
