Machine learning is a hot topic right now. But what is it, exactly? And what are the different types?
As a general rule, the three main types of machine learning are supervised, unsupervised, and reinforcement learning. These three types of machine learning refer to the way we supply information to the algorithm to help it learn.
In this article, I will cover the fundamentals of the three types of machine learning, explaining the fundamentals, covering:
- What is a machine learning algorithm?
- What are the three types of machine learning?
- What does supervised learning mean?
- What does unsupervised learning mean?
- What does reinforcement learning mean?
- How do we train a machine learning model?
What Is A Machine Learning Algorithm?
A machine learning algorithm is a set of instructions that helps a machine learn from data.
The algorithm takes in information, called features, and uses it to learn patterns or relationships. It then makes predictions based on these patterns or relationships.
A good way to think of a machine learning algorithm is to picture a black box.
We feed inputs to the black box, and it will give us an output.
The mathematical model that describes the machine learning algorithm is in this black box. We must feed data to the algorithm in order to train it so that it can learn to predict patterns.
What Are The Three Types Of Machine Learning?
Continuing the black box analogy, there are typically three ways in which we can provide information to the machine learning algorithm in order for it to learn.
These three types or ways of teaching the machine learning algorithm are:
- Supervised Learning
- Unsupervised Learning
- Reinforcement Learning
These three types of machine learning differ in what data we supply to the machine learning algorithm.
What Does Supervised Learning Mean?
Supervised learning is where the machine learning algorithm learns from a set of example data.
We give the algorithm a set of input data and the correct answer.
It then uses this data to learn patterns and make predictions. Supervised learning is the most common type of machine learning.
Again, using the black box analogy, we supply inputs to the black box (i.e. the mathematical machine learning algorithm) but also tell the black box what the targets are.
It is easy to remember this as “supervised learning” as someone fully supervised the process. We tell the algorithm the inputs and the desired targets.
As a result, the algorithm will learn how to take our inputs and produce results that are very close to our targets.
What Does Unsupervised Learning Mean?
Unsupervised learning is where the machine learning algorithm is given data but not examples of what to learn. It uses this data to find patterns itself.
We can use this for things like clustering, where the algorithm groups similar data together. Unsupervised learning is less common than supervised learning.
Using the black box analogy, we supply inputs to the algorithm but do not provide targets.
In effect, we are asking the algorithm to sort through data and find some sort of logic or dependency or pattern.
What Does Reinforcement Learning Mean?
Reinforcement learning is where the machine learning algorithm learns from the feedback it receives from its environment.
The algorithm tries different actions and gets feedback on whether these actions were good or bad. It then uses this feedback to improve its predictions.
Reinforcement learning is less common than supervised and unsupervised learning.
This type of machine learning algorithm is most similar to human behaviour. Similar to humans who receive positive feedback for a task and then continue doing a good job, we are feeding the algorithm with positive feedback, which then continues to perform optimally.
How Do We Train A Machine Learning Model?
Once we have an overview of the three types of machining learning, we can then look at how to train a machine learning model.
Typically, we can break down the training of a machine learning algorithm into four stages, which form part of the machine training process:
- Data preparation
- Choosing the type of machine learning model.
- Optimising the model.
- Optimising the algorithm
The following steps are just an overview of the process. You can study each section in much greater detail, but I have found that it helps to have an overview of the iterative machine learning training process before digging too deep into the details.
1. Data Preparation For Machine Learning Model
In order to get our inputs for our machine learning model, we need to prepare data.
The data we prepare will depend on what we are trying to analyse and represent the problem we’re trying to solve. For example, if we’re trying to predict the weather, we’ll need data on temperature, humidity, and wind speed.
This data is often historical, as we are using past events to predict the future.
When preparing data for machine learning, it’s important to clean and format it correctly. The data should be in a format the machine learning algorithm can understand. This usually means converting the data into a numerical format.
Once the data is ready, we can train a machine learning model. This model will then use the data to make predictions.
2. Choosing The Type Of Machine Learning Model
When choosing a machine learning model, we need to consider the type of data we have and the problem we’re trying to solve.
If our data is numeric, we can use a variety of machine learning models, such as linear regression or neural networks. If our data is text or images, we can use machine learning models that are specifically designed for those types of data, such as convolutional neural networks for images.
We also need to decide what type of problem we’re trying to solve. If we’re trying to predict the future, we can use a model that predicts values for a target variable. If we’re trying to cluster data, we can use a model that finds patterns in the data.
3. Optimising The Model (Objective Function)
Once our model is running, we need to measure the predictive power of the model.
In machine learning, the objective function measures the predictive power of a machine learning model. In a nutshell, we want to see how well our model output is matching the desired targets.
An objective function is a mathematical function that takes as input a set of parameters and returns a single number. This number is called the objective or cost function. The objective function helps us to optimise our machine learning algorithm by finding the best set of parameters.
In the world of machine learning, typically the objective function can be split into two main types:
- Loss – which is found in supervised learning.
- Reward – which is found in reinforcement learning.
The details of objective functions are beyond the scope of this article, as I want to give an overview for the beginner, however, if you want to learn more about the importance of objective functions in machine learning I recommend checking out his article, Objective Functions in Machine Learning
4. Optimising The Algorithm
An optimisation algorithm is a mathematical algorithm that helps us to find the best set of parameters for our machine learning model. It takes as input a set of parameters and an objective function and returns the best set of parameters according to the objective function.
There are many types of optimisation algorithms, such as gradient descent or conjugate gradient. The optimisation algorithm we use depends on the type of machine learning model we’re using and the type of data we have.
Machine learning is a process of data analysis that allows computers to learn from experience and improve.
There are three main types of machine learning: supervised learning, unsupervised learning, and reinforcement learning.
In supervised learning, the computer is given input data and desired output values, and it learns by adjusting its model to match the desired outputs.
In unsupervised learning, the computer finds patterns in input data with no guidance on what those patterns should be.
In reinforcement learning, the computer learns through trial-and-error feedback loops.
We can use all three types of machine learning for predictive modelling to make predictions about future events.