This project aims to analyze customer data to identify key factors leading to churn and to build a predictive model to detect at-risk customers. The primary goal is to provide actionable insights that can help in developing effective customer retention strategies.
The project addresses two business questions:
- What causes customers to churn?
- How can we improve customer retention?
The initial analysis of the dataset revealed a critical insight: customer complaints are the single strongest predictor of churn.
- Complaints and Churn Correlation: There is a near-perfect correlation between a customer making a complaint (
Complain= 1) and the customer churning (Exited= 1). - Statistical Significance: An astonishing 99.51% of customers who file a complaint end up churning. Conversely, 99.95% of customers who do not complain remain with the bank.
- Other Factors: Other features such as Credit Score, Card Type, and Satisfaction Score showed no significant difference between customers who churned and those who did not. Interestingly, customers who churned tended to have a higher average account balance.
Based on these findings, the core business strategy should be to proactively prevent and resolve customer complaints.
Given the strong link between complaints and churn, the modeling approach was pivoted. Instead of predicting churn directly, the model is trained to predict the likelihood of a customer filing a complaint. This serves as an early warning system.
- Feature Removal: Dropped irrelevant columns (
RowNumber,CustomerId,Surname). - Categorical Encoding:
- One-Hot Encoding was applied to nominal features like
GenderandGeography. - Label Encoding was used for ordinal features like
Card Type.
- One-Hot Encoding was applied to nominal features like
- Numerical Scaling: The
RobustScalerwas used to scale numerical features, minimizing the impact of outliers.
- Algorithm: An XGBoost Classifier was chosen for its performance and robustness in classification tasks.
- Target Variable:
Complain. - Hyperparameter Tuning:
GridSearchCVwas used to find the optimal parameters for the model, which were determined to be{'criterion': 'gini', 'max_depth': 3}. - Data Split: The dataset was split into 80% for training and 20% for testing.
The model's performance was evaluated on its ability to predict whether a customer would file a complaint.
The classification report is as follows: precision recall f1-score support
0.0 0.88 0.95 0.91 1568
1.0 0.73 0.51 0.60 432
accuracy 0.85 2000
- The model achieves an overall accuracy of 85%.
- However, the recall for the 'Complain' class (1.0) is 0.51. This indicates that the model correctly identifies only 51% of the customers who will actually complain. The high number of False Negatives means that the model still misses about half of the at-risk customers.
- While the model is a good starting point, further improvements are needed to increase the recall rate and reduce False Negatives.
The analysis conclusively shows that customer complaints are the primary driver of churn. Therefore, the most effective retention strategy is to minimize customer dissatisfaction.