A machine learning project to predict customer churn for a telecom company. This project includes data preprocessing, exploratory data analysis (EDA), model training, evaluation, and a Streamlit web app for interactive predictions.
- Data Cleaning & Preprocessing: Handles missing values, encodes categorical variables, and scales numeric features.
- Exploratory Data Analysis (EDA): Generates plots for churn distribution, numeric feature correlation, and other insights.
- Machine Learning Models: Random Forest and XGBoost with hyperparameter tuning.
- Imbalanced Data Handling: Uses SMOTE to balance classes.
- Model Evaluation: Accuracy, ROC AUC, classification report, confusion matrix, and feature importance.
- Web App: Streamlit app to input customer information and predict churn probability.
- Clone the repository:
git clone https://github.com/Shaikhasna/Telecom-Churn-Predictor.git cd Telecom-Churn-Predictor - Create and activate a virtual environment: python -m venv .venv ..venv\Scripts\activate # Windows source .venv/bin/activate # macOS/Linux
- Install dependencies: pip install -r requirements.txt
Run EDA python -m src.eda (Generates plots in the images/ directory.)
Train Model python -m src.train (Trains the model and saves it in models/churn_model.joblib.)
Evaluate Model python -m src.evaluate (Prints predictions and evaluation metrics.)
Run Streamlit App streamlit run app/streamlit_app.py (Open the app in your browser at http://localhost:8501.)
telecom-churn/ │ ├── app/ # Streamlit app │ └── streamlit_app.py ├── src/ # Source code │ ├── eda.py │ ├── train.py │ ├── evaluate.py │ └── data_utils.py ├── models/ # Saved models ├── images/ # EDA and evaluation plots ├── .venv/ # Virtual environment ├── requirements.txt └── README.md
Shaik Hasna