Machine learning is a subfield of artificial intelligence (AI). The goal of machine learning generally is to understand the structure of data and fit that data into models that can be understood and utilised by people. Two of the most widely adopted machine learning methods are supervised learning and unsupervised learning.
Supervised Learning
Supervised learning works as a supervisor or teacher. Basically, In supervised learning, we teach or train the machine with labeled data (that means data is already tagged with some predefined class). Then we test our model with some unknown new set of data and predict the level of them.
Types of supervised learning:
- Regression: Predicts continuous outcome
- Classification: Predicts categorical outcome. (Outcome=Yes or No, Black or White)
Unsupervised Learning
In unsupervised learning there would be no correct answer and no teacher for guidance. Algorithms need to discover the interesting pattern in data for learning.
In my model I have used Random Forest Classification model for training my data. I have taken a small dataset which is listed below. In this data set we have five training features (Overall Grade, Obedient, Assignment, Project Score, Research Score) and one output feature (Recommend). The output will be predicted based on these five training features.
I have trained the model over the training features and predicted the output for my test dataset. After that I have calculated the accuracy of my model. After the model is ready, we need to save it. Pickle is the standard way of serializing objects in python. I have used the pickle operation to serialize my machine learning model and saved the serialized format to a file (filename.pkl). Later I have loaded this file to deserialize my model and used it to make new predictions.
Now I have written a streamlit code to built my machine learning web app. I have saved this file as test_app.py. To run this app we need to type streamlit run test_app.py in the anaconda prompt. The output of new prediction and the web page is listed below.
Comments
Post a Comment