# ayub-datascience/customer-churn-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/ayub-datascience/customer-churn-prediction
- Repository: https://github.com/ayub-datascience/customer-churn-prediction

## Overview

This repository is a notebook-based customer-churn classification project. Its documented workflow moves from dataset cleaning and exploration through stratified splitting and preprocessing to training four classifiers, evaluating them with recall-focused metrics and 10-fold cross-validation, and selecting the Decision Tree model. The tree also includes saved models, predictions, and metric tables. Source excerpts were unavailable, so relationships below rely on the README’s workflow description; notebook-internal calls and artifact-generation details cannot be verified.

Main entry points: [`06_Training_and_Testing.ipynb`](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb) (Classifier training), [`07_Cross_Validation_Method.ipynb`](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/07_Cross_Validation_Method.ipynb) (10-fold validation), [`05_Creating_Pipelines_for_Preprocessing.ipynb`](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/05_Creating_Pipelines_for_Preprocessing.ipynb) (Preprocessing pipeline), [`cleaned_customer_churn_data.csv`](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/cleaned_customer_churn_data.csv) (Cleaned data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Data analysis"]
  node_raw_data["Customer data"]
  node_cleaning["Clean dataset"]
  node_clean_data["Cleaned data"]
  node_eda["Churn exploration"]
end

subgraph group_modeling["Model development"]
  node_split["Stratified split"]
  node_train_data["Training data<br/>[training_data.csv]"]
  node_test_data["Testing data<br/>[testing_data.csv]"]
  node_preprocessing["Preprocessing pipeline"]
  node_train_preprocessed["Prepared training data"]
  node_test_preprocessed["Prepared testing data"]
  node_training["Classifier training"]
  node_logistic["Logistic regression"]
  node_decision_tree["Decision tree"]
  node_random_forest["Random forest"]
  node_gradient_boosting["Gradient boosting"]
end

subgraph group_evaluation["Evaluation and selection"]
  node_cross_validation["10-fold validation"]
  node_evaluation_metrics["Model metrics"]
  node_selection["Recall-based selection"]
end

subgraph group_artifacts["Saved outputs"]
  node_saved_models["Trained models"]
  node_prediction_outputs["Predictions"]
end

node_analyst(("Project analyst"))
node_business_user(("Retention decision-maker"))

node_analyst -->|"inspects"| node_raw_data
node_raw_data -->|"cleaned by"| node_cleaning
node_cleaning -->|"produces"| node_clean_data
node_clean_data -->|"explored in"| node_eda
node_clean_data -->|"split into"| node_split
node_split -->|"produces"| node_train_data
node_split -->|"produces"| node_test_data
node_train_data -->|"transformed by"| node_preprocessing
node_test_data -->|"transformed by"| node_preprocessing
node_preprocessing -->|"prepares"| node_train_preprocessed
node_preprocessing -->|"prepares"| node_test_preprocessed
node_training -->|"trains"| node_logistic
node_training -->|"trains"| node_decision_tree
node_training -->|"trains"| node_random_forest
node_training -->|"trains"| node_gradient_boosting
node_train_preprocessed -->|"used for training"| node_training
node_test_preprocessed -->|"used for testing"| node_training
node_decision_tree -->|"validated by"| node_cross_validation
node_logistic -->|"validated by"| node_cross_validation
node_random_forest -->|"validated by"| node_cross_validation
node_gradient_boosting -->|"validated by"| node_cross_validation
node_training -->|"evaluated with"| node_evaluation_metrics
node_cross_validation -->|"compared by recall"| node_selection
node_evaluation_metrics -->|"informs"| node_selection
node_selection -->|"selects"| node_decision_tree
node_training -->|"saves"| node_saved_models
node_training -->|"produces"| node_prediction_outputs
node_prediction_outputs -->|"supports retention decisions"| node_business_user

click node_raw_data "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/customer_churn_data.csv"
click node_cleaning "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/02_Understanding_and_Cleaning_the_Dataset.ipynb"
click node_clean_data "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/cleaned_customer_churn_data.csv"
click node_eda "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/03_Exploratory_Data_Analysis.ipynb"
click node_split "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/04_Splitting_the_Data_into_Train_and_Test.ipynb"
click node_train_data "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/training_data.csv"
click node_test_data "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/testing_data.csv"
click node_preprocessing "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/05_Creating_Pipelines_for_Preprocessing.ipynb"
click node_train_preprocessed "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/training_data_preprocessed.csv"
click node_test_preprocessed "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/testing_data_preprocessed.csv"
click node_training "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb"
click node_logistic "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb"
click node_decision_tree "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb"
click node_random_forest "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb"
click node_gradient_boosting "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb"
click node_cross_validation "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/07_Cross_Validation_Method.ipynb"
click node_evaluation_metrics "https://github.com/ayub-datascience/customer-churn-prediction/tree/main/metrics"
click node_selection "https://github.com/ayub-datascience/customer-churn-prediction/blob/main/07_Cross_Validation_Method.ipynb"
click node_saved_models "https://github.com/ayub-datascience/customer-churn-prediction/tree/main/models"
click node_prediction_outputs "https://github.com/ayub-datascience/customer-churn-prediction/tree/main/predictions"

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_data,node_cleaning,node_clean_data,node_eda toneBlue
class node_split,node_train_data,node_test_data,node_preprocessing,node_train_preprocessed,node_test_preprocessed,node_training,node_logistic,node_decision_tree,node_random_forest,node_gradient_boosting toneAmber
class node_cross_validation,node_evaluation_metrics,node_selection toneMint
class node_saved_models,node_prediction_outputs toneRose
class node_analyst,node_business_user toneIndigo
```

## Components

### Data analysis

- [Customer data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/customer_churn_data.csv): `customer_churn_data.csv`
- [Clean dataset](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/02_Understanding_and_Cleaning_the_Dataset.ipynb): `02_Understanding_and_Cleaning_the_Dataset.ipynb`
- [Cleaned data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/cleaned_customer_churn_data.csv): `cleaned_customer_churn_data.csv`
- [Churn exploration](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/03_Exploratory_Data_Analysis.ipynb): `03_Exploratory_Data_Analysis.ipynb`

### Model development

- [Stratified split](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/04_Splitting_the_Data_into_Train_and_Test.ipynb): `04_Splitting_the_Data_into_Train_and_Test.ipynb`
- [Training data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/training_data.csv): `training_data.csv`
- [Testing data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/testing_data.csv): `testing_data.csv`
- [Preprocessing pipeline](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/05_Creating_Pipelines_for_Preprocessing.ipynb): `05_Creating_Pipelines_for_Preprocessing.ipynb`
- [Prepared training data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/training_data_preprocessed.csv): `training_data_preprocessed.csv`
- [Prepared testing data](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/testing_data_preprocessed.csv): `testing_data_preprocessed.csv`
- [Classifier training](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb): `06_Training_and_Testing.ipynb`
- [Logistic regression](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb): `06_Training_and_Testing.ipynb`
- [Decision tree](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb): `06_Training_and_Testing.ipynb`
- [Random forest](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb): `06_Training_and_Testing.ipynb`
- [Gradient boosting](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/06_Training_and_Testing.ipynb): `06_Training_and_Testing.ipynb`

### Evaluation and selection

- [10-fold validation](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/07_Cross_Validation_Method.ipynb): `07_Cross_Validation_Method.ipynb`
- [Model metrics](https://github.com/ayub-datascience/customer-churn-prediction/tree/main/metrics): `metrics`
- [Recall-based selection](https://github.com/ayub-datascience/customer-churn-prediction/blob/main/07_Cross_Validation_Method.ipynb): `07_Cross_Validation_Method.ipynb`

### Saved outputs

- [Trained models](https://github.com/ayub-datascience/customer-churn-prediction/tree/main/models): `models`
- [Predictions](https://github.com/ayub-datascience/customer-churn-prediction/tree/main/predictions): `predictions`

### Other components

- **Project analyst**
- **Retention decision-maker**

## Connections

- Project analyst → Customer data: inspects (evidence: `README.md`)
- Customer data → Clean dataset: cleaned by (evidence: `README.md`)
- Clean dataset → Cleaned data: produces (evidence: `README.md`)
- Cleaned data → Churn exploration: explored in (evidence: `README.md`)
- Cleaned data → Stratified split: split into (evidence: `README.md`)
- Stratified split → Training data: produces (evidence: `README.md`)
- Stratified split → Testing data: produces (evidence: `README.md`)
- Training data → Preprocessing pipeline: transformed by (evidence: `README.md`)
- Testing data → Preprocessing pipeline: transformed by (evidence: `README.md`)
- Preprocessing pipeline → Prepared training data: prepares (evidence: `README.md`)
- Preprocessing pipeline → Prepared testing data: prepares (evidence: `README.md`)
- Classifier training → Logistic regression: trains (evidence: `README.md`)
- Classifier training → Decision tree: trains (evidence: `README.md`)
- Classifier training → Random forest: trains (evidence: `README.md`)
- Classifier training → Gradient boosting: trains (evidence: `README.md`)
- Prepared training data → Classifier training: used for training (evidence: `README.md`)
- Prepared testing data → Classifier training: used for testing (evidence: `README.md`)
- Decision tree → 10-fold validation: validated by (evidence: `README.md`)
- Logistic regression → 10-fold validation: validated by (evidence: `README.md`)
- Random forest → 10-fold validation: validated by (evidence: `README.md`)
- Gradient boosting → 10-fold validation: validated by (evidence: `README.md`)
- Classifier training → Model metrics: evaluated with (evidence: `README.md`)
- 10-fold validation → Recall-based selection: compared by recall (evidence: `README.md`)
- Model metrics → Recall-based selection: informs (evidence: `README.md`)
- Recall-based selection → Decision tree: selects (evidence: `README.md`)
- Classifier training → Trained models: saves (evidence: `README.md`)
- Classifier training → Predictions: produces (evidence: `README.md`)
- Predictions → Retention decision-maker: supports retention decisions (evidence: `README.md`)
