If you are struggling with getting hands-on:
- What is supervised Machine learning?
- How it works ?
- What type of problems we can solve using it?
Then congratulations you are at the right place because here you will get an in-depth understanding related to supervised machine learning ๐ค
What is supervised machine learning?
Before knowing about the formal definition of supervised machine learning, I hope that you are aware that supervised machine learning is one of the 3 types of Machine learning and is the most flexible, comprehensive, and covers a wide range of the common ML tasks that are high in demand nowadays. So here is the formal definition
Now you might have doubts about, how well-labeled data look ? , so before taking a look at labeled data let me take an example after you which you not only understand how labeled data looks like but will also be able to understand how supervised machine learning actually works.
Let us assume that you are a Machine learning engineer and you want to sell your car because you are shifting abroad for your next job role, now in a hurry you are not sure that the price at which you are selling your car is right or you are getting fooled by the dealer. So here you will try to use your machine learning skills by making a machine learning model that will predict the price of the car based on some features like ( mileage of the car, number of tyres, kilometers driven, transmission type, fuel type ), etc. Here in this case we are assuming that you will take the dataset from Kaggle,
After loading the dataset in google collab ( software used for doing machine learning ) and writing code given below
car_dataset = pd.read_csv('/content/car_dataset.csv')
car_dataset.head() # To show first 5 rows of the dataset
You will get a table that contains some features like the name of the car, km_driven, fuel, selling Price, transmission, and owner. This is what labeled data looks like because here as you can see the column of the selling price is our objective (output) which we want our machine learning model to predict using the features. So for every set of features in the individual row there is some particular output attached to it, thus here we will use supervised machine learning
How supervised machine learning work?
In order to understand the working of supervised machine learning, you also must be aware about the preparations which we need to do before training our machine learning model.
Here are some of the steps which you need to do prior to training your model using some machine learning algorithms :
- First of all select the target variable which in the case we are discussing will be the selling price ( target variable is the feature which we want our machine learning model to predict ).
- After you are done with selecting the target variable now select the features which you think will be useful for training our machine learning model, because sometimes all the features provided in the dataset may not be useful.
- Followed by a selection of the target now select your machine learning algorithm based on the analysis of your data, ( There are multiple algorithms in supervised machine learning itself so in the next blog you will learn how to select the perfect algorithm for training your machine learning model.
- Finally divide your data set into 2 sets ( Training data and Testing data ) , because first of all you will feed the training data into your selected algorithm and after training you will test the performance of your model using the testing data .
Visual Representation of Supervised Machine Learning Process
If this diagram is a little overwhelming for you then don't worry let me explain it ๐
- First of all the blue part is a useful feature and the red part of labeled data is our target value
- Followed by this classification the division of labeled data into test data and train data will take place
- After which both the useful features and target value will be fed into the supervised machine learning algorithm chosen by the user which in return will give us some machine learning model
- Once we will get our machine learning model trained by the training data we will test it by feeding the useful features from the test data corresponding to which our machine learning model will give some output ( predicted value )
- The output given by the machine learning model, which is also known as the predicted output will be compared to the target variable of test data known as actual data.
- By doing the comparison of actual data with the predicted data we will calculate the accuracy and if we are not satisfied with the accuracy then we will use some methods to increase its efficiency, which will be discussed in the next blog.
Types of Supervised Machine Learning
If we are talking about supervised machine learning, then there are basically 2 types of problems that we can solve using this type and those 2 types of problems are :
- Classification Problems
- Regression Problems
Now the question arises what is classification and regression? , so once again down below you will get the basic understanding of both classification and regression, at the same time in the next blog post we will discuss the ( types of classification and regression ) + ( Algorithms used for these 2 types )
Classification Problems Classification problems are basically those problems in which the output generated by the machine learning model will be the classification of the input provided or fed into the model. Apart from it in classification, our machine learning model will always give us a discrete output which means for a given feature or group of features the output generated by our machine learning model will be categorized into finite numbers of categories only.
In the figure above you can see there can be binary classification of the provided input or multiclass classification, but the total number of possible outcomes will always be finite
Regression Problems Regression problems are basically those problems in which the output generated by the machine learning model will be a single output for the input provided or fed into the model instead of classification of the input value
In addition to it in case of regression, our machine learning model will always give us a continuous output which means with the change in feature or group of features the output generated by the machine learning model will be a new single value based on the change in the feature value, instead of changing the category of the output data which was the case in classification .
As you can see above, with the change in the feature ( TV ) the output generated by our machine learning model ( Sales ) is continuous, instead of finite categories.
That's it for today and in the next blog post, we will take a closer look at what are the types of regression, classification, and the algorithms related to those types.