How prernajoshipj/customer-churn-prediction works
Main Components
• User Interface (UI): Represented by the Streamlit frontend in app.py. This component is responsible for collecting user inputs (e.g., tenure, monthly charges) and displaying predictions with visualizations (charts, SHAP plots).
• Machine Learning (ML) Model: The pre-trained XGBoost model (stored as xgb_churn_model.pkl) is the core prediction engine. Note that the project notebook (project.ipynb) contains the process for model training and evaluation.
• Data Source: Include the telecom customer data (Telco_customer_churn.xlsx) which, while not actively queried at runtime, represents the historical data used for model training and evaluation.
• Dependency & Environment Management: The requirements.txt file lists the project dependencies (Pandas, NumPy, Scikit-learn, XGBoost, etc.) and the .devcontainer folder indicates the use of a development container for environment standardization.
• Optional / Supporting Elements: Consider visualizations, SHAP analysis for model explainability, and the possibility of incorporating other future enhancements (e.g., deployment details if moving to Streamlit Cloud).
Relationships and Interactions
• User Interaction: The end-user interacts with the Streamlit UI which sends input data to the backend.
• Data Flow: Once the user input is received, the Streamlit app loads the pre-trained XGBoost model and processes the input to generate churn predictions along with feature impact analysis.
• Data Source Connection: Though not directly integrated at runtime, the training data (Telco_customer_churn.xlsx) informs the model and may be referenced as part of the data pipeline in model retraining scenarios.
• Development Environment: The .devcontainer and requirements.txt files suggest a containerized development setup, which is a supporting architecture element.
Architectural Patterns & Technologies
• Separation of Concerns: Clearly separate the frontend (user interaction with Streamlit) from the backend (the ML model prediction logic).
• Model Deployment: The deployment of a pre-trained model via on-the-fly input prediction represents a common pattern in ML apps.
• Microservice-Like Structure: Even though the project is contained within a few files, consider the app as having distinct modules—UI, ML processing, and model training—each of which could be evolved independently.
Elements
• Clear Labels: Name each component clearly (e.g., “Streamlit Frontend (app.py)”, “XGBoost Prediction Model (xgb_churn_model.pkl)”, “Data Source (Telco_customer_churn.xlsx)”).
• A side component that represents “Model Training & Evaluation (project.ipynb)” that indicates how the model was created and tested using the provided dataset.
• “Data Source (Telco_customer_churn.xlsx)” and indicate its role as the basis for training and evaluation.
• Optionally, include an environment module labeled “Development Container (.devcontainer)” along with “Dependencies (requirements.txt)” to show the overall project context.