The data is included in the data directory within this repo and it has been downloaded from @Kaggle
The objective of this project is build up a model that is capable of predicting the Credit Scores of users and being served via a web interface.
- EDA This project starts by exploring the data and applying a series of cleaning processes to put the data in a state that could be used to build classification models, the code of these operations could be found in this Notebook credit_cls_Data_Cleansing.ipynb.
- Modeling The modelling part utilizes
Mlflowfor experiments tracking and models registration. For reproducibility, you may runMlflow serverlocally or setup it up in a remote machine, in my case, I used Dagshub integratedMlflow server. At any case, make sure to have a.envfile available at the root directory and provide the following environment variables.
# In case of running Locally
MLFLOW_TRACKING_URI="http://localhost:<port-number>"
# In case of using Dagshub, provide the tracking credentials from Dagshub repo
MLFLOW_TRACKING_URI="https://dagshub.com/<account-name>/<repo-name>.mlflow"
MLFLOW_TRACKING_USERNAME="<account-name>"
MLFLOW_TRACKING_PASSWORD="<password-str>"
the code of the modelling could be found in this Notebook credit_score_modeling.ipynb.
Note
The results of the experiments are registered at the integrated Mlflow server with this Dagshub repo.
Out of three classifiers, (RandomForest, XGBoost and LightGBM), RandomForest classifier resulted in a slightly better metrics than XGBoost but that was at the expense of the model size where the best model of the RandomForest classifier has a size of 644.46 MB whilist the best model of XGBoost has a size of 7.36 MB. Therefore, the model that has been set to production was the fine-tunned model of XGBoost.
- Deployment The chosen method for serving the final model of the experimentations is a web interface. The frontend is built using streamlit, the backend is built using FastAPI and both of them are connected and served using Docker The code of the frontend could be found in /frontend directory and the backend as well could be found in the /backend directory.
- To run the web service use the following code
docker-compose up -d --buildThen go to the following url: http://localhost:8501/
- To stop the web service use the following code
docker-compose down