A complete end to end machine learning project (Bank Customer Churn Prediction) with MLflow and MLOps.
Customer Churn prediction means knowing which customers are likely to leave or unsubscribe from the service. Customer churn is important because it costs more to acquire new customers than to sell to existing customers. Following are the benefits of analyzing Customer Churn Prediction:
- Customer retention
- Increase profits
- Improve the customer experience
- Optimize the product and services
Initially, create a virtual environment and install the required library and packages by running:
pip install -r requirements.txt
Edit the following parameters in setup.py with yours:
- REPO_NAME = The name of your github repository
- AUTHOR_USER_NAME = your github user_name
- AUTHOR_EMAIL = github login_email
Download the datasets from here
The project is divided into 5-main pipelines:
In data ingestion pipeline, follow the following sequences:
- Change the source_URL, line 6 in config.yaml where the zip file of dataset is stored in your local machine.
In this pipeline, the following sequences are followed:
- Change the last part in unzip_data_dir, line 13 in config.yaml to the file name (Churn_Modelling.csv).
- Update all the column names, its data types and target_column name in schema.yaml .
In this pipeline, follow the below sequences:
- Perform EDA and fearure engineering in 03_data_transformation.ipynb.
- Import all the required packages and libraries and modify the fe_and_pre_process function in DataTransformation class as per all feature engineering and preprocess steps in data_transformation.py
In this pipeline, follow the below sequences:
- Select the ML algorithm to be used.
- Insert all the hyperparameters in params.yaml for the selected model in step 1.
- Update all the related hyperparameters and its datatypes for the model selected in step 1 in class ModelTrainerConfig in config_entity.py.
- Add and update all the related hyperparameters in function get_model_trainer_config in configuration.py.
- Initialize and fit the model selected in step 1, in function train of class ModelTrainer in model_trainer.py
In this pipeline, follow the below sequences:
- Update the mlflow_uri in get_model_evaluation_config function in configuration.py.
Now, after setting up the dagshub account, edit the main.py file and update the following variables with yours:
* os.environ["MLFLOW_TRACKING_URI"]
* os.environ["MLFLOW_TRACKING_USERNAME"]
* os.environ["MLFLOW_TRACKING_PASSWORD"]
Now, run the main file with
python main.py