{"id":27111928,"url":"https://github.com/thedatatenno/churn-prediction","last_synced_at":"2025-08-22T02:07:55.994Z","repository":{"id":286384869,"uuid":"961233853","full_name":"TheDataTenno/Churn-Prediction","owner":"TheDataTenno","description":"A machine learning project to predict customer churn using classification models with SMOTE and hyperparameter tuning.\"","archived":false,"fork":false,"pushed_at":"2025-04-06T05:12:49.000Z","size":1809,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T22:12:31.955Z","etag":null,"topics":["accuracy-score","churn-prediction","classification","confusion-matrix","data-science","f1-score","gridsearchcv","knn-classifier","logistic-regression","machine-learning","matplotlib","portfolio-project","python","random-forest","scikit-learn","seaborn","smote","telecom","xgboost-classifier"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheDataTenno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-06T03:55:17.000Z","updated_at":"2025-04-06T05:37:46.000Z","dependencies_parsed_at":"2025-04-09T22:07:57.884Z","dependency_job_id":null,"html_url":"https://github.com/TheDataTenno/Churn-Prediction","commit_stats":null,"previous_names":["thedatatenno/churn-prediction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheDataTenno/Churn-Prediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDataTenno%2FChurn-Prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDataTenno%2FChurn-Prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDataTenno%2FChurn-Prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDataTenno%2FChurn-Prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheDataTenno","download_url":"https://codeload.github.com/TheDataTenno/Churn-Prediction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDataTenno%2FChurn-Prediction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271574431,"owners_count":24783319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accuracy-score","churn-prediction","classification","confusion-matrix","data-science","f1-score","gridsearchcv","knn-classifier","logistic-regression","machine-learning","matplotlib","portfolio-project","python","random-forest","scikit-learn","seaborn","smote","telecom","xgboost-classifier"],"created_at":"2025-04-07T01:25:22.169Z","updated_at":"2025-08-22T02:07:55.978Z","avatar_url":"https://github.com/TheDataTenno.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"📊 Customer Churn Prediction\n\nThis project predicts customer churn using a supervised machine learning approach for a telecom company. While this dataset comes from the telecom industry, the methodology and techniques demonstrated here are **scalable and adaptable to any industry** where customer retention is vital—such as finance, insurance, SaaS, e-commerce, and beyond. \n\nThis project serves as a **showcase of my data science skillset**, including data preprocessing, class imbalance handling, algorithm comparison, hyperparameter tuning, and model interpretation.\n\n---\n\n## 🔍 Problem Statement\n\nCustomer churn—when a customer discontinues service—is a key metric for subscription-based companies. For this project, we analyze customer behavior to predict churn using various customer and service attributes. Our goal is to **identify customers at risk of churning**, allowing businesses to take proactive retention actions.\n\n---\n\n## 🧠 Algorithms Used\n\n- **Logistic Regression** (best performing model after SMOTE + tuning)\n- **Random Forest** (tuned using GridSearchCV, competitive performance)\n\nWe experimented with **K-Nearest Neighbors (KNN)** and **XGBoost**, but deprioritized them based on evaluation results.\n\n---\n\n## 🧪 Data Preprocessing\n\n- Removed irrelevant columns (`customerID`)\n- Encoded categorical variables with `LabelEncoder`/`get_dummies`\n- Addressed class imbalance using **SMOTE** (on training set only)\n- Train/test split: 80% train / 20% test\n\n---\n\n## 📈 Model Evaluation\n\nMetrics used to evaluate models:\n- Accuracy\n- Precision, Recall, F1-Score (especially for minority class)\n- Confusion Matrix\n- Feature Importance (visualized)\n\n---\n\n## 🔧 Best Model \u0026 Performance\n\n**Best Model**: Logistic Regression  \n**Tuned Hyperparameters**:  \n\n```python\n{ 'C': 0.1, 'penalty': 'l1', 'solver': 'liblinear' }\n```\n\n---\n\n| Metric       | Score |\n|--------------|-------|\n| Accuracy     | 0.779 |\n| Precision    | 0.58 (for churned class) |\n| Recall       | 0.63 (for churned class) |\n| F1-Score     | 0.60 (for churned class) |\n\n---\n\n## 🔍 Feature Importance\n\nBelow are the top 10 most influential features based on the two best models:\n\n### Logistic Regression\n![Logistic Regression Feature Importance](Visualizations/logistic_regression_feature_importance.png)\n\n### Random Forest\n![Random Forest Feature Importance](Visualizations/random_forest_feature_importance.png)\n\n\n---\n\n## 🧰 Tech Stack\n\n- **Languages**: Python 3.12  \n- **Libraries/Tools**:\n  - `pandas`, `numpy`, `matplotlib`, `seaborn` for data manipulation and visualization  \n  - `scikit-learn` for model training, evaluation, and hyperparameter tuning  \n  - `imblearn` for SMOTE-based class balancing  \n  - `joblib` for model saving  \n  - `Jupyter Notebook` + `VS Code` for development  \n\n---\n\n## 👨🏽‍💻 Author\n\n**Patrick Onuoha Jr.**  \nData Science Senior @ University of North Texas  \n🔗 [GitHub](https://github.com/TheDataTenno) | 📧 [Email](mailto:ponuoha2017@gmail.com) | 🧠 Passionate about building data-driven solutions that scale across industries.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedatatenno%2Fchurn-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedatatenno%2Fchurn-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedatatenno%2Fchurn-prediction/lists"}