Churn is a vital business metric that tracks the rate at which customers stop using services. In this project, we address two types of churn:
- Customer Churn: When a customer cancels their subscription or stops using a service.
- Revenue Churn: When revenue decreases due to cancellations, downgrades, or non-renewals. This is particularly critical for subscription-driven companies.
Installed Java and necessary H2O packages as the H2O platform requires Java for model execution. bash Copy code
pip install h2o
Loading the Dataset:
I used a dataset containing various customer attributes (e.g., gender, senior citizen status, tenure, payment method) and the churn status (yes/no). python Copy code import h2o from h2o.estimators import H2OAutoML
h2o.init()
churn_data = h2o.import_file("path/to/churn_data.csv") Splitting the Data:
The dataset was split into training, validation, and test sets to ensure effective model training, validation during training, and evaluation. python Copy code
train, valid, test = churn_data.split_frame(ratios=[.7, .15], seed=1234)
Training with H2O AutoML:
I leveraged H2O AutoML to automatically train multiple models, including GBM, GLM, and XGBoost. python Copy code
y = "Churn" x = churn_data.columns x.remove(y)
aml = H2OAutoML(max_models=10, seed=1) aml.train(x=x, y=y, training_frame=train, validation_frame=valid) Model Selection and Predictions:
The best-performing model was an XGBoost model, which demonstrated the highest accuracy and overall performance. python Copy code
best_model = aml.leader
churn_pred = best_model.predict(test)
The model's performance on the test set was evaluated using the aml.leader.model_performance(test) function. python Copy code
performance = best_model.model_performance(test) print(performance)
The automated approach using H2O AutoML provided valuable insights into customer churn patterns, offering clear indicators of why customers might leave. With these insights, businesses can take data-driven actions to mitigate churn risks and improve customer retention. Churn prediction is not just about identifying which customers will leave but also understanding the reasons behind it. By analyzing customer behavior patterns, businesses can enhance the overall customer experience, leading to increased customer satisfaction and loyalty. This project demonstrates the power of H2O AutoML in simplifying the model-building process for predicting customer churn. By automating the model selection process, we can efficiently address churn and help businesses make data-driven decisions to retain customers.- H2O AutoML
- XGBoost
- Python
- Jupiter Nootebook for interactive analysis and development
- Sklearn for data preprocessing Clone the repository to your local machine.
bash Copy code git clone https://github.com/JIGEESHA-ANAGANI/AUTOML/blob/main/AUTOML%20(1).ipynb Install the necessary dependencies
bash
Copy code
pip install -r requirements.txt
Open and run the churn_prediction.ipynb notebook to follow the entire workflow, from loading the dataset to training and evaluating the model.
