Machine Learning algorithms can be majorly classified into four types:
- Supervised Learning
- Unsupervised Learning
- Semi-supervised Learning
- Reinforcement Learning
In this article we will dive into supervised and unsupervised learning.
Introduction to Supervised Learning
In supervised learning, a sample labeled data is fed to the machine learning model to train it, based on which it predicts the final outcome. Therefore, supervised learning allows us to create a model using labeled data that reads the datasets and learns each feature of the data-set. After training and processing are complete then the model is tested with the help a sample data to check its efficiency of predicting the output on future data. Thus, the goal of supervised learning is to map input data to the output data.
In simple terms, supervised learning is the machine learning technique that is based on supervision, just like a student who learns under the supervision of a teacher.
Supervised learning is the machine learning task of learning a function that maps an input to an output based on example input-output pairs. It infers a function from labeled training data consisting of a set of training examples.(source: Wikipedia)
Example: Email Spam Filtering, Fraud Detection, Image classification, Risk Assessment, etc.
Working Principle Of Supervised Learning
- A labeled dataset is used to train the model in supervised learning. The model learns about every type of data using the labeled dataset.
- After the training phase is complete, the model is then tested for its accuracy and efficiency to predict the output on the basis of test data/test-set which is a subset of the training set
Let us have a look at the diagrammatic representation given below to understand how supervised learning works.
In the above example, we have a dataset of different types of animals which includes lion, rat, and dog. Now the first step is that we need to train the model for each animal type. Based on the shape of the animal they are labeled as Lion, Rat, and Dog. After training the model, it is tested using the test set, and the task of the model is to predict the type of animal provided to it. Thus, the machine is pre-trained about all types of animals, and when it finds a new animal, it classifies the animal on the basis of its label and predicts the output.
Now let us have a look at the different steps that are involved in supervised learning:
- Determine and Collect Information about the training dataset.
- Split the data-set into:
- training set
- test set
- validation dataset
- Determine the features of the input to the training dataset such that it has enough knowledge to predict the output correctly.
- Determine and feed in the suitable algorithm that helps the model to predict the output.
- Execute the applied algorithm on the training dataset.
- Evaluate the efficiency and accuracy of the model using the test-set.
Types of Supervised Learning
Supervised Learning can be further classified into two types:
Regression learning allows us to predict continuous outcome variables based on the value of one or more predictor variables. In simple words, it estimates the relationship between the input and output variables. The goal of regression model is to build a mathematical equation that defines y as a function of the x variables.
Example: Regression analysis can help us to determine the relationship between the number of rash driving cases to the number of road accident cases by a driver. Other use cases of regression are weather forecasting, stock market trends, etc.
Some commonly used Regression Methods are:
- Linear Regression
- Multiple Linear Regression
- Regression Trees
- Polynomial Regression
- Support Vector Regression
- Random Forest Regression
Classification methods have a similar goal to regression models. Thus classification is a predictive modeling technique where a label is predicted for a given input. The difference between regression and classification is that the dependent attributes are numerical for regression while they are categorical for classification.
In classification the output variable is categorical, that means it can be values like yes-no, true-false, spam-not spam, etc.
Example: Classification methods can be used for filtering emails to determine whether they are spam or not spam.
Some commonly used classification models are:
- Logistic regression
- Decision tree
- Random forest
- Gradient-boosted tree
- Multilayer Perceptron
- Naive Bayes
Introduction to Unsupervised Learning
As the name suggests, unsupervised learning is a machine learning technique wherein the machinery model learns without any supervision. The model receives its training from a data-set that is unlabeled or uncategorized and the algorithm works without the need of a supervisor. The goal of unsupervised learning is to reorganize the input data into a group of objects with similar patterns. Therefore, in unsupervised learning, the results are not predetermined.
Unsupervised learning is a type of machine learning that looks for previously undetected patterns in a data set with no pre-existing labels and with a minimum of human supervisionSource: Wikipedia
Working Principle Of Supervised Learning
As mentioned above, in unsupervised learning the model does not have a supervisor. Therefore, we do not provide any labeled data in this case. Let us have a look at the diagram given below to understand how unsupervised learning works:
Unlike supervised learning the data taken here is unlabeled (raw-data). This raw data is fed into the machine learning model which interprets it to find the hidden patterns. Once it identifies the pattern, a suitable algorithm is applied which divides the data objects into different groups based on the similarities and differences between the objects that is learned by the model from the hidden patterns.
Types of Unsupervised Learning
Unsupervised learning can be further classified int two types:
?️ Note: We will learn about clustering and association in later articles.
Let us have a look at some of the most commonly used unsupervised learning algorithms:
- K-means clustering
- Apriori algorithm
- KNN (k-nearest neighbors)
- Neural Networks
- Hierarchal clustering
- Principle Component Analysis
- Independent Component Analysis
- Singular value decomposition
Difference Between Supervised and Unsupervised Learning
|Supervised Learning||Unsupervised Learning|
|Labeled data is used to train Supervised learning algorithms.||Unsupervised learning algorithms are not trained using labeled data. Instead, they are fed unlabeled raw-data.|
|A supervised learning model accepts feedback to check and improve the accuracy of its predictions.||Unsupervised learning models do not take feedbacks.|
|A supervised learning model is output driven i.e. it predicts a final output based on a given input.||Unsupervised learning models are used to identify hidden patterns in raw data.|
|The goal of supervised learning is to map input data to the output data and predict a final output. Therefore, supervised learning is used in scenarios where the input, as well as corresponding outputs, are known.||The goal of unsupervised learning is to reorganize the input data into a group of objects with similar patterns. Therefore, unsupervised learning models are used in scenarios where we only have the input data but there is no corresponding output data.|
|Supervised learning models are trained under supervision.||Unsupervised learning models do not need any supervision to train them.|
|Supervised learning can be grouped into Classification and Regression problems.||Unsupervised Learning can be grouped into Clustering and Associations problems.|
|A supervised learning model is generally expected to produce accurate results since the output is predetermined.||As compared to supervised learning, an unsupervised learning model may produce less accurate results.|
|Some commonly used supervised learning algorithms are Linear Regression, Support Vector Machine, Logistic Regression, Decision tree, Bayesian Logic, Multi-class Classification, etc.||Some commonly used unsupervised learning algorithms include Clustering, Neural Networks, KNN, Apriori algorithm, etc.|
We have successfully dissected supervised and unsupervised learning in this article and we have a clear picture of how these learning techniques work. We will learn more about each algorithm in great detail in future articles.
Please click on the link given below to move on to the next section of our Machine Learning tutorial!
Where to Go From Here?
Enough theory. Let’s get some practice!
Coders get paid six figures and more because they can solve problems more effectively using machine intelligence and automation. To become more successful in coding, solve more real problems for real people. That’s how you polish the skills you really need in practice. After all, what’s the use of learning theory that nobody ever needs?
You build high-value coding skills by working on practical coding projects!
Do you want to stop learning with toy projects and focus on practical code projects that earn you money and solve real problems for people?
If your answer is YES!, consider becoming a Python freelance developer! It’s the best way of approaching the task of improving your Python skills—even if you are a complete beginner.
Join my free webinar “How to Build Your High-Income Skill Python” and watch how I grew my coding business online and how you can, too—from the comfort of your own home.