This repository contains a machine learning model designed to predict customer churn in an Iranian telecom company. The project includes model training, evaluation, deployment via Docker, and a RESTful API for serving predictions.
To set up this project locally, follow these steps:
- Clone the repository:
git clone https://github.com/Greenskin44/churn-prediction.git cd churn-prediction - Usage
a. Train and Evaluate the Model To train and evaluate the model, use:
import joblib model = joblib.load('Optimized_IRN_churn_prediction_model.pkl') predictions = model.predict(X_test)
c. Model Explanation Use LIME for explainability on a single instance or SHAP (if supported):
from lime import lime_tabular
explainer = lime_tabular.LimeTabularExplainer(...)
explanation = explainer.explain_instance(X_test.iloc[0],
model.predict_proba)
- Model Explainability
from lime import lime_tabular explainer = lime_tabular.LimeTabularExplainer(...) explanation = explainer.explain_instance(X_test.iloc[0],model.predict_proba) explanation.show_in_notebook() - Docker Deployment
a. This project includes Docker setup for consistent deployment. For full Docker instructions, see Docker/README.md.
docker build -t churn-model . docker run -p 5000:5000 churn-model - API Instructions
a. The API exposes a /predict endpoint for making predictions. Detailed API usage can be found in API/README.md.
python app.py
c. API Endpoint: POST /predict for prediction with JSON data input.
-
CI/CD Pipeline a. We use GitHub Actions for continuous integration and deployment. For details on the CI/CD setup, see .github/README.md.
-
License a. This project is licensed under the Apache 2.0 License. See the LICENSE file for details.