Table of Contents
In this project explained how to implement the random forest on a credit risk data using jupyter notebook. Followed by deploying the model using the heroku.
- Python - 3x
- Data science packages
- Dash
- Jupyter Notebooks / google colabs
- HTML code
Overall end-to-end process has been divided into 4 steps. The execution of the files should also be in the same order. In individual the required input files are already mentioned in the code comments.
- 1_EDA.ipynb
- Performing teh exploratory data analysis on the credit risk data.
- 2_Model_Buidling.ipynb
- Building a Random forest model and saving the model as a file.
- 3_Credit_Risk_Prediction.ipynb
- Loading the model and predicting new data
- 4 heroku deployment
- The model is deployed as a app.
The dataset for the project is extarcted from the kaggle competetion.
https://www.kaggle.com/code/turanmehdiyeva/credit-risk-descriptive-statistical-analysis/data
- At first, during preprocessing the categorical variables label encoded and this encoding objects are stored by in label_dict.pkl and similar min_max_scaler.pkl file for the normalisation.
- Then creating an account in heruko for free. Then created a dash python file named app.py(for convenience I used the generic name). As DASH uses flask, the app was built for a flask deployment and it doesn't support static files.
- As third step I have designed code to capture all the required fields for the model prediction.
- The model is tested locally just by invoking python file
python app.py
. - Now it is more of app deployment in heroku
As a prerequsite, one should have the following things
- An account in the Heroku https://dashboard.heroku.com/
In the git folder one should below files
2. requirements.txt - with all the python packages required for app.
3. Procfile - an no extension file with command web: gunicorn app:server
(if you are using different name for the main dash file please replace the same in the command)
4. Define which python runtime you want for your model in runtime.txt, Please also check if the runtime is compatible with heroku.
5. Build the app.py with the required fields
6. Finally, push the code to the repo
In this step it is more about deploying the app in heroku app.
- Login to Heroku and navigate to apps
- create new app with the names available (be creative ).
- Now navigate to the 'Deploy' tab and like your github under "Deployment method'"
- Under Connect to Github -> please provide the repo name in which the app is placed
- Under Manual Deploy -> please select tge branch and click "Deploy branch"
- Once this is successfully done you should get the url to access the website. In my case it is - https://cr369.herokuapp.com/
Distributed under the GNU License. See LICENSE.txt
for more information.
Developed by Frankfurt School Data Science initiative members.
Project Link: https://github.com/chaitanya2593/CRA_pratice