Project 8: End-To-End Loan Approval Predictor WebApp with an integrated CI/CD pipeline
Understanding The Business Problem
Loan Applications can be daunting for both the clients and the bank organisation. A lot of resources such as time and finances , the risk of trusting a client to pay back the loans is considered for every application. Manual processing is just not efficient with hundreds of thousands of applications and can be biased a lot of the times.
The Data Science Solution
Using Machine Learning to automate the loan eligibility process in real time where the major eligibility criteria focuses on the assurance of getting the money back from the clients.
The Machine Learning model is a classifier that uses potential bank client’s background and personal information to predict if they are eligible for a loan.
Exploratory Data Analysis and Feature Engineering
- Mining insights from Exploratory Data Analysis to identify what features are strongly correlated with each other and how they affect the classification.
- Data cleansing and modification for the best results
Model Building
- After splitting the data into train and test sets, I tested out different kinds of algorithms for my classifer such as Gaussian NaiveBayes, RandomForest, DecisionTree, XGBoost and Support Vector.
- Leveraged GridsearchCV and RandomizedSearchCV to tune the hyperparameters of the classifiers for the best results.
- Evaluated the model by precision, recall and accuracy scores. Decision Tree was the best for our case.
- Utilized Joblib to save the model as a pickle file which will act as the backend for our WebApp.
![](https://mugiiwaraaa.github.io/Fahad_Portfolio/images/schema_loan.png)
WebApp Schema
The Loan Predictor WebApp
- After training the Machine Learning model which acts as the backend for our webApp, we proceed to build the Frontend Application using Flask which is a REST API Framework and allows the client and the model to interact with each other.
- The Frontend is designed using Tailwind CSS blocks which takes the required features needed for giving us a prediction from the client using the WebApp.
- Gunicorn is a Python web server application that makes it possible to use this Webapp to work on the internet.
The Use of Docker and GitHub Actions for Deployment
-
As you can see in the Schema above, the whole architecture is inside a docker image. This image can be run as a container on any environment regardless of the software and hardware requirements. The docker image contains all the prerequisites and the libraries needed to build the model and the WebApp.
-
The WebApp long with some necessary files which include a Requirements.txt file, Dockerfile, Procfile and a .yaml file. Lets understand what these are:
i. Dockerfile - Set of Instructions to build the docker image
ii. Procfile - Required by Heroku which will be our PAAS to understand the mapping
iii. .yaml file - Configuration file for GitHub Actions to build the CI/CD pipeline
iv. Requirements.txt - List of all the Python libraries required to build the WebApp
-
After The files are pushed into a GitHub Repository, GitHub Action automates the deployment of the docker image containing the webApp on Heroku.
WebApp
Feel free to test out the WebApp. Link to the WebApp
Please Check out my Github Repository for all the details: Link to Github Repository