# geethasagarb/coursera-churn-prediction-challenge architecture

> Architecture diagram of the GitHub repository geethasagarb/coursera-churn-prediction-challenge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/geethasagarb/coursera-churn-prediction-challenge
- Repository: https://github.com/geethasagarb/coursera-churn-prediction-challenge

## Overview

##### Main Components
- Data Sources: Include the raw CSV files (train.csv, test.csv, data_descriptions.csv) and the output file (prediction_submission.csv) which represent the input datasets and the predicted results.
- Jupyter Notebook Environment: The ChurnPrediction.ipynb acts as the central orchestrator of the machine learning workflow.
- Data Cleaning & Preprocessing Module: Represents steps for handling missing values, converting categorical variables to numeric, and applying encoding techniques (e.g., One-Hot Encoding via ColumnTransformer).
- Feature Engineering Module: Emphasis on the creation of additional features derived from subscription details, usage behavior, etc.
- Model Training & Evaluation: The core machine learning component where a Logistic Regression model is built inside a pipeline, with configuration for hyperparameters and evaluation using ROC AUC score.
- Business Outcome Component: Represents the insights generated for proactive churn intervention, emphasizing cost reduction and retention strategies.

##### Relationships and Interactions
- Data Flow: Start from the data sources, then show the sequential flow into preprocessing, feature engineering, model training, and finally model evaluation and prediction output.
- Pipelines: Highlight the pipeline-based approach which integrates preprocessing and model training, reinforcing the modular and sequential architecture.

##### Architectural Patterns & Design Principles
- Pipeline Architecture: Central to integrating multiple stages (preprocessing, feature engineering, and logistic regression) in a streamlined flow.
- Separation of Concerns: Distinct modules handling data input, transformation, model development, and evaluation.
- Reproducibility & Scalability: The notebook-based workflow coupled with modular code encourages easy updates, testing, and potential deployment (as an API or integration into a CRM system).

##### Relevant Technologies and Frameworks
- Python, Jupyter Notebook, Pandas, NumPy, and Scikit-learn (especially for model development, feature engineering via ColumnTransformer, and logistic regression).

- Annotation: For each component, include brief notes about the key functions, such as “One-Hot Encoding using ColumnTransformer” in Preprocessing, or “Logistic Regression with Hyperparameter Settings” in Model Training.
- Detail Data Flow: Illustrate that train.csv feeds into the preprocessing module, while test.csv also goes through similar processing to generate predicted outputs stored in prediction_submission.csv.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Sources
    subgraph "Data Sources"
        train["train.csv"]:::dataFile
        test["test.csv"]:::dataFile
        desc["data_descriptions.csv"]:::dataFile
    end

    %% Jupyter Notebook Environment
    jnb["Jupyter Notebook Environment (ChurnPrediction.ipynb)"]:::notebook

    %% Processing Modules inside the Notebook Pipeline
    preproc["Data Cleaning & Preprocessing\n(Handles missing values, categorical conversion, One-Hot Encoding via ColumnTransformer)"]:::process
    feat["Feature Engineering\n(Generates features from subscription details and usage patterns)"]:::process
    model["Model Training & Evaluation\n(Logistic Regression with hyperparameters, ROC AUC evaluation)"]:::model

    %% Output and Business Outcome Components
    output["Prediction Output\n(prediction_submission.csv)"]:::dataFile
    business["Business Insights\n(Churn Intervention Strategies)"]:::business
    doc["Documentation\n(README.md)"]:::doc

    %% Data Flow
    train --> jnb
    test  --> jnb
    desc  --> jnb
    jnb --> preproc
    preproc --> feat
    feat --> model
    model --> output
    output --> business
    output --> doc

    %% Click Events
    click train "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/train.csv"
    click test "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/test.csv"
    click desc "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/data_descriptions.csv"
    click jnb "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/ChurnPrediction.ipynb"
    click output "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/prediction_submission.csv"
    click doc "https://github.com/geethasagarb/coursera-churn-prediction-challenge/blob/main/README.md"

    %% Styles
    classDef dataFile fill:#ffefba,stroke:#d35400,stroke-width:2px;
    classDef notebook fill:#d6eaf8,stroke:#2e86c1,stroke-width:2px;
    classDef process fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef model fill:#fdebd0,stroke:#e67e22,stroke-width:2px;
    classDef business fill:#e8f8f5,stroke:#16a085,stroke-width:2px;
    classDef doc fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
```
