{"id":26025321,"url":"https://github.com/preethi2805/customer-churn","last_synced_at":"2026-06-28T17:31:42.190Z","repository":{"id":274571479,"uuid":"923355569","full_name":"Preethi2805/Customer-Churn","owner":"Preethi2805","description":"This project focuses on predicting customer churn for a telecommunications company using machine learning models. The dataset contains various features such as customer demographics, service usage, and billing information, which are used to predict whether a customer will churn (leave the service).","archived":false,"fork":false,"pushed_at":"2025-02-23T19:18:24.000Z","size":1701,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T13:41:34.756Z","etag":null,"topics":["customer-churn-prediction","decision-trees","eda","knearest-neighbor-algorithm","logistic-regression","pickle","random-forest","smote","svm-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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Preethi2805.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-28T04:48:42.000Z","updated_at":"2025-02-23T19:18:27.000Z","dependencies_parsed_at":"2025-01-28T05:25:38.717Z","dependency_job_id":"e6bebd71-bb1a-4dcf-9116-2cf820349034","html_url":"https://github.com/Preethi2805/Customer-Churn","commit_stats":null,"previous_names":["preethi2805/customer-churn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Preethi2805/Customer-Churn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Preethi2805%2FCustomer-Churn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Preethi2805%2FCustomer-Churn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Preethi2805%2FCustomer-Churn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Preethi2805%2FCustomer-Churn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Preethi2805","download_url":"https://codeload.github.com/Preethi2805/Customer-Churn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Preethi2805%2FCustomer-Churn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34898562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"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":["customer-churn-prediction","decision-trees","eda","knearest-neighbor-algorithm","logistic-regression","pickle","random-forest","smote","svm-classifier"],"created_at":"2025-03-06T13:35:40.098Z","updated_at":"2026-06-28T17:31:42.181Z","avatar_url":"https://github.com/Preethi2805.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Customer Churn Prediction\n\n\n## Project Overview\nCustomer churn, also known as customer attrition, refers to the phenomenon where customers stop doing business with a company. The goal of this project is to predict customer churn using various machine learning models for a telecom company. The project involves:\n- Data cleaning and preprocessing.\n- Exploratory Data Analysis (EDA) to understand the dataset.\n- Handling class imbalance using **SMOTE** (Synthetic Minority Oversampling Technique).\n- Training and evaluating multiple machine learning models, including Decision Tree, Random Forest, KNN, Support Vector Machine, and Logistic Regression.\n\n---\n\n## Dataset\nThe dataset used in this project is the **Telco Customer Churn Dataset** from Kaggle, which contains the following features:\n- **customerID**: Unique identifier for each customer.\n- **gender**: Gender of the customer (Male/Female).\n- **SeniorCitizen**: Whether the customer is a senior citizen (0 or 1).\n- **Partner**: Whether the customer has a partner (Yes/No).\n- **Dependents**: Whether the customer has dependents (Yes/No).\n- **tenure**: Number of months the customer has stayed with the company.\n- **PhoneService**: Whether the customer has a phone service (Yes/No).\n- **MultipleLines**: Whether the customer has multiple lines (Yes/No/No phone service).\n- **InternetService**: Type of internet service (DSL, Fiber optic, No).\n- **OnlineSecurity**: Whether the customer has online security (Yes/No/No internet service).\n- **OnlineBackup**: Whether the customer has online backup (Yes/No/No internet service).\n- **DeviceProtection**: Whether the customer has device protection (Yes/No/No internet service).\n- **TechSupport**: Whether the customer has tech support (Yes/No/No internet service).\n- **StreamingTV**: Whether the customer has streaming TV (Yes/No/No internet service).\n- **StreamingMovies**: Whether the customer has streaming movies (Yes/No/No internet service).\n- **Contract**: Type of contract (Month-to-month, One year, Two year).\n- **PaperlessBilling**: Whether the customer has paperless billing (Yes/No).\n- **PaymentMethod**: Payment method (Electronic check, Mailed check, Bank transfer, Credit card).\n- **MonthlyCharges**: Monthly charges for the customer.\n- **TotalCharges**: Total charges for the customer.\n- **Churn**: Target variable indicating whether the customer churned (Yes/No).\n\n---\n\n## Data Preprocessing\n- **Handling Missing Values**: Missing values in the `TotalCharges` feature were replaced with `0.0`.\n- **Encoding Categorical Variables**: Categorical features were label encoded using `LabelEncoder`.\n- **Handling Class Imbalance**: The dataset was imbalanced, with only 27% of customers churning. **SMOTE** was used to balance the dataset by oversampling the minority class.\n\n---\n\n## Exploratory Data Analysis (EDA)\n- **Distribution of Features**: Histograms and box plots were used to understand the distribution of numerical features like `tenure`, `MonthlyCharges`, and `TotalCharges`.\n  \n![Histogram](hist.png)\n\n- **Geographical Visualization**: Scatter plots were used to visualize the relationship between `MonthlyCharges` and `Churn`.\n- **Correlation Analysis**: A correlation matrix was used to identify the relationship between numerical features.\n\n![Correlation matrix for numerical features](correlation.png)\n\n- **Count Plots**: Count plots were used to visualize the distribution of categorical features.\n\n---\n\n## Model Training\nFive models were trained and evaluated:\n1. **Decision Tree**: Achieved an accuracy of **78%**.\n2. **Random Forest**: Achieved an accuracy of **84%**.\n3. **K-Nearest Neighbors (KNN)**: Achieved an accuracy of **77%**.\n4. **Support Vector Machine (SVM)**: Achieved an accuracy of **64%**.\n5. **Logistic Regression**: Achieved an accuracy of **79%**.\n\nThe **Random Forest** model performed the best and was selected for further evaluation.\n\n---\n\n## Results\n- **Random Forest Model**:\n  - **Accuracy**: 77.86%\n  - **Confusion Matrix**:\n    - True Positives (TP): 219\n    - True Negatives (TN): 878\n    - False Positives (FP): 158\n    - False Negatives (FN): 154\n  - **Classification Report**:\n    - Precision (Class 0): 0.85\n    - Recall (Class 0): 0.85\n    - F1-Score (Class 0): 0.85\n    - Precision (Class 1): 0.58\n    - Recall (Class 1): 0.59\n    - F1-Score (Class 1): 0.58\n---\n\n## Technologies Used\n- **Python**: Primary programming language.\n- **Pandas**: Data manipulation and analysis.\n- **NumPy**: Numerical computations.\n- **Matplotlib \u0026 Seaborn**: Data visualization.\n- **Scikit-learn**: Machine learning models and evaluation.\n- **SMOTE**: Handling class imbalance.\n- **Pickle**: Saving and loading models and encoders.\n- \n---\n\n## Future Work\n- Experiment with more advanced models like Gradient Boosting or Deep Learning.\n- Perform hyperparameter tuning to improve model performance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreethi2805%2Fcustomer-churn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreethi2805%2Fcustomer-churn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreethi2805%2Fcustomer-churn/lists"}