# pabhit007/customer-churn-prediciton architecture

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

- Interactive diagram: https://gitdiagram.com/pabhit007/customer-churn-prediciton
- Repository: https://github.com/pabhit007/customer-churn-prediciton

## Overview

##### Project Type and Purpose
- This is a machine learning project aimed at predicting customer churn using a data pipeline.

##### Analyzing the File Structure
- README.md – Contains the overall project objectives and workflow.
- apps.py – Likely serves as the application entry point for running or deploying the prediction application; it may be responsible for handling prediction requests, interfacing with a potential API, or integrating the model in a production-like environment.
- preprocessing.py – Handles data cleansing, transforming, and key feature extraction before the data is used by the model.
- task-intern.py – Acts as a driver script for tasks such as training the model, validating it, or perhaps even making batch predictions.
- model.pkl and model.sav – These files represent saved artifacts of trained models (possibly in different serializations), which are used during the prediction phase.

##### Proposed Components and Their Relationships
a. Data Source (External or Internal):

b. Data Preprocessing Module:
- Component: Preprocessing Layer (using preprocessing.py)
- Function: Cleans the raw data and creates key features for churn prediction.

c. Model Training and Evaluation:
- Component: Training Pipeline (possibly represented by task-intern.py)
- Function: Uses the processed data to train the machine learning model. It includes the training, validation, and testing steps outlined in the README.
- Artifact: The trained models are saved as model.pkl and model.sav.

d. Model Artifacts:
- Component: Model Storage
- Function: Stores the serialized models used for predictions.

e. Deployment / Prediction Layer:
- Component: Prediction/Application Server (possibly implemented through apps.py)
- Function: Loads the trained model to make predictions on new customer data in real time or as a batch process.
- Interaction: This layer uses model artifacts to respond to input data from new customer interactions and outputs churn predictions.

##### Architectural Patterns and Design Principles
- Separation of concerns by isolating data preprocessing, model training, and deployment as distinct modules.
- Use of common modular design in ML pipelines where data flows sequentially through a series of transformations and decisions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Data Source - Customer Data"]:::data
    B["Data Preprocessing (preprocessing.py)"]:::processing
    C["Model Training & Evaluation (task-intern.py)"]:::training
    subgraph "Model Artifacts"
        D["model.pkl"]:::artifact
        E["model.sav"]:::artifact
    end
    F["Deployment/Prediction Server (apps.py)"]:::deployment

    A -->|"flows"| B
    B -->|"flows"| C
    C -->|"saves_model"| D
    C -->|"saves_model"| E
    D -->|"used_by"| F
    E -->|"used_by"| F

    click A "https://github.com/pabhit007/customer-churn-prediciton/blob/main/README.md"
    click B "https://github.com/pabhit007/customer-churn-prediciton/blob/main/preprocessing.py"
    click C "https://github.com/pabhit007/customer-churn-prediciton/blob/main/task-intern.py"
    click D "https://github.com/pabhit007/customer-churn-prediciton/blob/main/model.pkl"
    click E "https://github.com/pabhit007/customer-churn-prediciton/blob/main/model.sav"
    click F "https://github.com/pabhit007/customer-churn-prediciton/blob/main/apps.py"

    classDef data fill:#f9f,stroke:#333,stroke-width:2px;
    classDef processing fill:#bbf,stroke:#333,stroke-width:2px;
    classDef training fill:#bfb,stroke:#333,stroke-width:2px;
    classDef artifact fill:#ff9,stroke:#333,stroke-width:2px;
    classDef deployment fill:#fc9,stroke:#333,stroke-width:2px;
```
