After running multiple experiments by using Decision Tree and Naive Bayes, we managed to choose the best model to use. For the data product, we chose to do with Streamlit as it is one of the easiest and simplest open-source frameworks to use for Machine Learning and Data Science. Below is the model we used for the data product:
Financial Level: Experiment 1 (80:20) before Hyperparameter Tuning
Health Level: Experiment 1 (60:40) after Hyperparameter Tuning
Step 1: install streamlit and pyngrok.
Step 2:
Write the code and save it to the current instance file using %%writefile health.py, %%writefile financial.py and %writefile app.py.
Since we have two models, the health.py is for health level and financial.py is for financial level. After that, we will overwrite the app.py for health and financial level. So, when we run the streamlit, it will show both prediction models and the user can choose which prediction he/she wants.
In the prediction function, we used a lot of if-else statement to assigned categories to actual data.
In the main function, we used this function to construct and design the interface for the streamlit such as the background colour, selectbox and slider.
Step 3:
Use the command to run streamlit.
Step 4:
Use pyngrok to connect a tunnel to the streamlit port.
After executing this code, the following link will come out. If we click on the link, the link will direct us to streamlit application.
<NgrokTunnel: "http://ba4177894990.ngrok.io" -> "http://localhost:80">