MLProject-Customer-Churn-EDA-and-Prediction GitHub Details, Stars and Alternatives | OpenRepoFinder
txs7n / repository
MLProject-Customer-Churn-EDA-and-Prediction
A Python project dedicated to predicting customer churn within the telecommunications sector. Leveraging a dataset of customer interactions and demographics, this project dives deep into rigorous Exploratory Data Analysis to uncover underlying patterns and behaviors factors contributing to customer churn, as well as building a classifier model.
A transparent discovery signal based on current public GitHub metadata.
Recent activity35% weight
10
Community adoption25% weight
0
Maintenance state20% weight
100
License clarity10% weight
0
Project information10% weight
35
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
README preview
MLProject-Customer-Churn-EDA-and-Prediction
Overview
This repository hosts a Python project dedicated to predicting customer churn within the telecommunications sector. Leveraging a dataset of customer interactions and demographics, I embark on a journey through rigorous Exploratory Data Analysis (EDA) to uncover underlying patterns, behaviors, and factors contributing to customer churn. Building upon these insights, I then develop and refine a machine learning classifier model designed to accurately forecast potential churn, enabling targeted customer retention strategies.
Data
The data used in this project was gotten from Kaggle. There were five (5) csv files containing different information about the customers.
Tools
Python: For data processing and modeling.
Pandas & NumPy: For data manipulation.
Matplotlib & Seaborn: For data visualization.
Random Forrest Classifier: For predictive modeling.
Scikit-learn: For model evaluation and metrics calculation.
Process
The EDA process started with merging the five datasets containing all the information I needed. Right before that, I had to do an initial cleanup of the column names to ensure they were consistent with the recommended snake_cased naming convention. After the data merge, I had a dataset of 7,043 rows and 56 columns.
I checked for nulls and the data appeared to be mostly clean, except for two columns 'churn_reason' and 'churn_cat'; which both tell us the reason why customers say they churn (about 15 unique reasons) and the churn reason category respectively. To simplify things, the churn reason category was created to group the 15+ possible reasons into 5 distinct categories that capture all the possible churn reasons.
Out of the 7043 observations, there were 5174 nulls in both these two columns. This is a very high number of null data so I could not just discard the entire column without due process. I sought to uncover the reason for this staggering amount of nulls and found that these represented the customers who did not churn. No data was recorded in these two columns hence the reason why it was assigned NaN. I proceeded to fill the null values with 'None' to represent the customers that did not churn.
Once the nulls were taken care of, I proceeded to exploratory data analysis to answer the questions that naturally came up with the information in the dataset.
Exploratory Data Analysis
I started my EDA by checking the percentage of customers that churned as opposed to those that did not. I found a highly imbalanced dataset of 73% not churned; 27% churned. This overall churn ratio served as my baseline for comparing the behavior of specific segments within this dataset.
ALGORITHMICALLY RELATED
Similar Open-Source Projects
Selected from shared topics, language and repository description—not editorial ratings.
LangChain & Prompt Engineering tutorials on Large Language Models (LLMs) such as ChatGPT with custom data. Jupyter notebooks on loading and indexing data, creating prompt templates, CSV agents, and using retrieval QA chains to query the custom data. Projects for using a private LLM (Llama 2) for chat with PDF files, tweets sentiment analysis.
The churn ratio for customers who are male and female aligns closely with the overall churn ratio. This suggests that customers in both gender groups behave similarly to the average customer with respect to churn. Therefore, gender does not significantly affect churn behavior and might not be a strong predictor of churn on its own.
How does being below or above 30 affect customer churn?
For those under 30, 78% did not churn while 22% churned. For those over 30, 72% did not churn and 28% did. The churn ratios in both groups here (under and above 30) are similar to the overall churn ratio of 73% and 27% with only slight variations. We cannot explicitly say this variable affects churn on its own.
How does senior citizenry affect churn?
Non-Senior Citizens (74% not churned, 26% churned): The churn ratio for customers who are not senior citizens aligns closely with the overall churn ratio. This similarity suggests that the non-senior citizen group behaves similarly to the average customer with respect to churn. Therefore, being a non-senior citizen, in this case, does not significantly deviate from the expected churn behavior and might not be a strong predictor of churn on its own.
Senior Citizens (58% not churned, 42% churned): The churn ratio for senior citizens, however, significantly differs from the overall churn ratio, with a much higher percentage of churn. This indicates that senior citizens as a group are more susceptible to churning compared to the average customer. The significant deviation from the overall churn rate suggests that senior citizen status might be an important factor or predictor of churn.
Why do senior citizens churn?
Now that we have established that senior citizens churn. I sought to understand why because in the list of churn reasons, 'Deceased' was among. I wanted to ensure this was not the leading cause of churn among senior citizens.
From the analysis, the majority of the reasons why senior citizens churn is because of competitors, customer support attitude, and price.
How does being married affect churn?
We see that the churn ratio for the married variable deviates significantly, in opposite directions, for both groups. Considering the overall churn ratio of 73% not churned and 27% churned, we see that those who are not married tend to churn more (67% not churned, 33% churned) than those who are married (80% churned, 20% not churned).
How does having dependents affect churn?
From our analysis, we see that those who have dependents tend to even be more loyal as 93% of this group are retained while only 7% are churned. While those without dependents, with a ratio of 67% not churned; 33% churned, are slightly more susceptible to churning.
How does giving referrals affect churn?
As expected, those who refer a friend tend to be more loyal than those who do not refer a friend (considering the churn ratio baseline of 73% to 27%). Those who referred a friend had a churn ratio of 81% not churned; 19% churned. While those who did not refer a friend had a churn ratio of 67% not churned; 33% churned.
How does having phone service affect churn?
A lot more people who have phone service use this company's telecom service.
Both groups (i.e. customers that use phone service and those that do not) do not deviate from the churn ratio baseline (73% not churned; 27% churned) because those that use phone service have a churn ratio of 73% not churned; 27% churned while that do not have phone service so we cannot say this feature significantly affects churn in any meaningful way on its own.
How does having multiple lines affect churn?
Customers with multiple lines => 71% not churned, 29% churned. Customers without multiple lines => 75% not churned, 25% churned. Having multiple lines or not does not significantly affect churn as the churn ratio of both groups does not deviate significantly from the baseline churn ratio.
How does having internet service affect churn?
An interesting phenomenon develops here; those without internet service tend to be more loyal (93% not churned; 7% churned) than those with internet service (68% not churned; 32% churned).
How does having online security affect churn?
Customers with online security => 85% not churned, 15% churned. Customers without multiple lines => 69% not churned, 31% churned. Those without online security tend to be churners than those with online security, although the deviation from the baseline for the latter is not too wide. Those with online security, on the other hand, tend to be very loyal.
How does having unlimited data affect churn?
Customers having unlimited data => 68% not churned, 32% churned. Customers without unlimited data => 84% not churned, 16% churned. Looking at the percentages of both groups we see that they both deviate from the baseline significantly. Interestingly, customers who have unlimited data tend to be more churners than customers who do not have unlimited data. This could correspond to the 'have phone service' feature because in that case, customers who had phone service were the churners over those who did not. And it is the customers that have phone service that have higher chances of having unlimited data (or better still, being on the unlimited data plan service).
How does having premium tech support affect churn?
Customers with premium tech support => 85% not churned, 15% churned. Customers without multiple lines => 69% not churned, 31% churned. Deviation from the churn ratio baseline goes in the opposite direction for both groups. Customers without premium tech support tend to be churners while those with premium tech support are more loyal.
How does using paperless billing affect churn?
Customers that use paperless billing => 66% not churned, 34% churned. Customers that do not use paperless billing => 84% not churned, 16% churned. Customers who use paperless billing are more likely to be churners than those who do not use paperless billing.
How does payment method affect churn?
Most of the customers of this telecom company use bank withdrawal payment method.
Bank withdrawal customers (66% not churned; 34% churned).
Credit card customers (86% not churned; 14% churned)
Mailed check customers (63% not churned; 37% churned)
Of all the customer who use diverse payment methods, those who
Project using machine learning to predict depression using health care data from the CDC NHANES website. A companion dashboard for users to explore the data in this project was created using Streamlit. Written with python using jupyter notebook for the main project flow/analysis and visual studio code for writing custom functions and creating the dashboard.
biosignalsnotebooks project includes a set of Jupyter Notebooks explaining some processing tasks which have been specially designed for biosignalsplux and OpenSignals users. A Python package is also present, containing some functions to support biosignalsnotebooks notebooks or to be used independently.