utanvir/telco_churn
0
π Telco Churn Prediction Dashboard
End-to-end machine learning pipeline for predicting customer churn using the Telco dataset. Includes preprocessing, model training, evaluation, and deployment via a Streamlit dashboard.
π₯ Demo
π§ Features
- β‘ Modular pipeline architecture (clean, reusable code)
- π§Ή Preprocessing & feature engineering:
- Missing value handling
- Scaling, binning, one-hot encoding
- Polynomial & interaction features
- Feature selection with SelectKBest
- π€ Model training with hyperparameter tuning:
- LogisticRegression
- RandomForest
- GradientBoostingClassifer
- AdaBoostClassifier
- SVC
- KNeighboursClassifier
- DecisionTreeClassifier
- GuassianNB
- MLPClassifier
- XGBoost
- π Evaluation metrics: Accuracy, Precision, Recall, F1, AUC-ROC
- ποΈ Interactive Streamlit dashboard:
- Exploratory Data Analysis (EDA)
- Model evaluation & visualization (Confusion Matrix, ROC Curve)
- Real-time churn predictions
- CSV export of predictions
π Project Structure
churn-prediction-2/
βββ artifact/ # Stores intermediate artifacts
βββ Chun_prediction.egg-info/ # Metadata for packaging
βββ logs/ # Log files
βββ ml_venv/ # Virtual environment (should be gitignored)
βββ notebook/ # Jupyter notebooks
β βββ data/
β β βββ telco_churn.csv # Dataset
β βββ eda.ipynb # Exploratory Data Analysis
β βββ MODEL TRAINING.ipynb # Model training notebook
βββ src/ # Source code
β βββ components/ # Core components
β β βββ data_ingestion.py
β β βββ data_transformation.py
β β βββ model_trainer.py
β β βββ __init__.py
β βββ pipeline/ # Training & prediction pipelines
β β βββ train_pipeline.py
β β βββ predict_pipeline.py
β β βββ __init__.py
β βββ exception.py # Custom exception handling
β βββ logger.py # Logging utility
β βββ utils.py # Helper functions
β βββ __init__.py
βββ templates/ # Flask HTML templates
β βββ home.html
β βββ index.html
βββ .gitignore
βββ .python-version
βββ app.py # Flask entrypoint
βββ streamlit_app.py # Streamlit dashboard
βββ requirements.txt # Dependencies
βββ setup.py # Setup for packaging
βββ README.md # Project documentationπ How to Run
1. Clone the Repository
git clone https://github.com/your-username/churn-prediction_v2.git
cd churn-prediction_v22. Install Dependencies
pip install -r requirements.txt3. Run Training Pipeline
python -m src.pipeline.train_pipeline4. Launch Streamlit Dashboard
streamlit run streamlit_app.pyπ¦ Dependencies
- pandas
- matplotlib
- seaborn
- numpy
- scikit-learn==1.6.1
- imblearn
- xgboost
- dill
- Flask
- streamlit
- (See
requirements.txtfor full details)
π Dataset
This project uses the Telco Customer Churn dataset available at: Kaggle Telco Churn Dataset (https://www.kaggle.com/datasets/blastchar/telco-customer-churn)
π License
MIT - Youβre free to use, modify, and share it.
π‘ Future Improvements
- βοΈ Cloud deployment (Hugging Face, AWS, Heroku)
- π AutoML (Optuna / RandomizedSearch)
- π Handle unseen schema in uploaded CSVs
- π Real-time monitoring dashboard with Streamlit metrics
π€ Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
