A beginner’s guide to how machines learn

Arne Wolfewicz

Intro

Once you get into artificial intelligence and machine learning, there’s no way to avoid three terms:

  • Supervised learning
  • Unsupervised learning
  • Reinforcement learning

These are the three most common ways of how machines can learn, therefore understanding their meaning and differences is important to know when getting started with artificial intelligence. If you are new to the field, we recommend that you first read about the different disciplines of artificial intelligence.

Note: There are also other ways for machines to learn but this would break the format. Also, it is not necessary when starting out. Think of it like this: When you need them, you will know.

Machine learning in the context of AI

Illustration: Machine Learning is a subset of Artificial Intelligence. There are three types of ML: Supervised Learning, Unsupervised Learning and Reinforcement Learning.
Machine Learning is a subset of Artificial Intelligence. There are three types of ML: Supervised Learning, Unsupervised Learning and Reinforcement Learning.

Machine learning is a subset of overall artificial intelligence and the general term for when computers learn from data. It describes the intersect of computer science and statistics where algorithms are used to perform a specific task without being explicitly programmed; instead, they recognize patterns in the data and make predictions once new data arrives. Eventually, it is the way of learning that is most often used to categorize machine learning in three broad categories: supervised learning, unsupervised learning and reinforcement learning.

Three forms of machine learning

Supervised learning

Supervised learning makes use of a known relationship between input and output. This is where labeled data comes into play: The goal of the algorithm is to learn from “correct answers” in the training data and use the insights to make predictions when given new input data.

There are two main tasks of supervised learning:

  • Regression: Predict a continuous numerical value. Example: "How long will it take you to drive home from work given distance, traffic, time and day of the week?"
  • Classification: Assign a label. Example: "Is this a picture of a car or a truck?"

To see how supervised algorithms work, let’s look at a simple example for image classification: Imagine you were given a set of images each of which either depicts a car or a truck. Instead of labeling the pictures all on your own, you want to build an algorithm which does the work for you.

  1. Create a set of labeled data, i.e. "correct" data with both input and output information: pictures of cars and trucks, each with the corresponding class names.
  2. Feed the model with that labeled training dataset: The machine learning algorithm begins to "see" patterns between input (image) and output (class). The algorithm might learn complex relationships as "the distance between wheels is larger for trucks" – note that in reality it is usually hard to interpret algorithms in such a way.
  3. Test the model on unseen data and measure how accurately it predicts the class.

The term supervised learning stems from the fact that, in the beginning, we gave the algorithm a data set in which the “correct answers” were given. This is the key difference to unsupervised learning.

Unsupervised learning

While supervised learning requires input-output pairs (or labeled data) to learn, unsupervised learning algorithms use input data only (unlabeled data). Albeit a bit less intuitive, this learning method is suitable for problems where we have little or no idea what our results should look like. The goal is to gain knowledge and find structure in the data.

Take, for instance, a list of a company’s customers (input data). The CEO of a company wishes to better understand his customers but does not yet know what kind of customer segments exist (no output data). Through unsupervised learning, the algorithm would automatically discover and group customers into different customer segments.

The goal of supervised learning is to make predictions based on a training set of labeled data. The goal of unsupervised learning is to cluster unlabeled data.
The goal of supervised learning is to make predictions based on a training set of labeled data. The goal of unsupervised learning is to cluster unlabeled data.

The difference between supervised and unsupervised becomes evident in the visualization above. While for supervised learning we already know that there are two categories (blue circle and red cross) we do not in unsupervised learning. Instead, it is the task of unsupervised learning to discover these two clusters.

Reinforcement learning

In reinforcement learning, the algorithm (in this context also often referred to as agent) learns through trial-and-error using feedback to its own actions. Rewards and punishment operate as signals for desired and undesired behavior.

The best context to understand reinforcement learning is in a game with a clear objective and a point system. Imagine the following game set-up, in which a mouse (the agent) tries to maximize its rewards in a maze.

A mouse trying to maximize its rewards in a maze is a good representation of reinforcement learning. (Image credits: Chaitanya Sagarundefined)

At the end of the maze waits the final reward of +1,000 points: cheese. Along the way there are lesser rewards, in form of water, worth +50 points as well as electric shocks resulting in -100 points.  Through rewards and punishment the mouse gets positive and negative feedback to its behavior and learns from its own experience.

You might ask: How does reinforcement learning compare to supervised and unsupervised learning?

Similar to supervised learning, the algorithm maps input and output. The difference is that there is no labeled training data: While supervised learning algorithms need to be fed with “correct answers” (i.e. labeled data) in the beginning, reinforcement learning uses rewards and punishment as signals for desired and undesired behavior. If you are mathematically inclined, reinforcement learning is maximizing its reward function whereas the others are minimizing the loss (i.e. wrong predictions).

Compared to unsupervised learning, reinforcement learning is different in terms of goals. While the goal in unsupervised learning is to find clusters in your data (e.g. customer segments), reinforcement learning seeks to find a suitable action model that maximizes the total cumulative reward of the agent.

Reinforcement learning is widely used in building AI for playing computer games. A prominent example is Google’s computer program AlphaGo Zero. It received massive media attention by defeating the South Korean world champion in the ancient Chinese game of Go – a feat that used to be considered beyond the reach of even the most sophisticated computer programs.

Summary

To briefly sum up the different types of machine learning:

  • Machine learning is the field of study that gives computers the ability to learn without being explicitly programmed.
  • Supervised learning, unsupervised learning and reinforcement learning are the three broad categories of machine learning.
  • In supervised learning, we already know that there is a relationship between input and output and, therefore, feed the algorithm with labeled data. The goal is to make predictions when given new input data.
  • In unsupervised learning, we don't necessarily know the relationships between variables in the dataset. The goal of the algorithm is to gain knowledge and find structure.
  • In reinforcement learning, the algorithm learns through trial-and-error in an interactive environment using feedback from its own actions. The goal of maximizing long-term rewards drives the decision-making process.

Where to go from here? If you want to continue learning about artificial intelligence check out some of our other posts on this matter. We also wrote a few articles on how this can be done without programming, such as this one.

Now that you're here

levity is a tool that allows you to train AI models on images, documents, and text data. You can rebuild manual workflows and connect everything to your existing systems without writing a single line of code.

If you liked this blog post, you'll probably love levity.

Thank you! We'll be in touch soon.
We are sorry - something went wrong. Please try again!

More from our Blog

Remote work: Not a trend but the new normal

Working from home does not equal working remotely, even if they overlap significantly and pose similar challenges – remote work is also a mindset.

Read story

colabel becomes Levity

We changed our brand name from colabel to Levity to better reflect the nature of our product. Our co-founder shares how it all came about.

Read story

Empowering laboratory personnel to work from home – through ML

A story on how one of our customers managed to rethink how and where work takes place in this enforced new normal.

Read story

Stay inspired.

Sign up and get thoughtfully curated content delivered to your inbox.
We will never share your email address with third parties. And we don't like spam either.