It is a common occurrence for bank customers to default to other banks. This project involves exploring the data of bank customers and try to establish churning patterns, and then use the knowledge gained to predict churn for other customers. Then we turn our solution into a full mlops project to automate and continually optimize the entire process
More information on the data used for this project can be found here
-
Notebooks
Here we create notebooks where we clean and preprocess the data, before training our ml models. We train different models and select the best performing model.
We spend minimal time building the model so as to focus on the major goal of the project (MlOps). -
Mlflow and Model Registry
We use Mlflow and Model Registry to track the performance of our models. This gives us a structured way to monitor and store our artifacts (models, preprocessors, etc). We access our stored artifacts multiple times to train new models. -
Workflow Orchestration with Prefect
Prefect allows us to set a defined structure for our project. We can deploy our project and use work queues to track our deployments and run them whenever we wanr as prefect flows.
The prefect ui also provides an interface to see our flow runs and logs from every run. -
Deployment
Here we deploy our model as a web service using flask. We also use docker o add an eextra layer of isolation for the web service. We build a version of the service using our artifacts stored in model registry. -
Monitoring with Evidently, Grafana, Adminer
We use evidently to track how model performance by defining metrics on our data. Adminer to manage por postgres database where store our metrics from evidently.
Then we use Grafana to pull these data metrics and create dashboards to make monitoring these metrics easier. -
Best-Practices
Here we create tests for our scripts to make sure the result of every run is exactly what we intended. We use Pytest, DeepDiff, and Make to run and automate the tests.
- After pulling the repo into your preferred directory, install all the necessary dependencies from the requirements file by running:
pip install -r requirements.txt
- You can now automatically run the tests and the flask service by running:
make
- Now the flask web service is running and you can send a request by running the sample request in the scripts-test directory:
first cd into the directory by running:
cd scripts-test
- Now run the sample-request module by running:
python sample-request.py