Back to Blog
Split illustration of a robotic head with a circuit-brain graphic beside an abstract neural network node map, titled "Introduction to Machine Learning"
AI & ML
Dec 13, 2018
8 Min Read

Introduction to Machine Learning

Machine learning is like teenage sex: Everyone talks about it, nobody really knows how to do it, everyone thinks everyone else is doing it, so everyone claims they are doing it…

That line comes from Professor Dan Ariely, the James B. Duke Professor of Psychology and Behavioral Economics at Duke University (source). He originally tweeted it about big data, but it applies just as well to machine learning.

Big data is like teenage sex

A lot of people who say they’re “doing machine learning” are really just following someone else’s steps. They look up a popular model, use their own data, click train, and think they’re done. But it’s not usually that simple. Real machine learning means cleaning up your data, learning about the problem, picking the right method or algorithm, and then training your model. This process gets even trickier when you have a lot of data.

If your dataset is small, the process can look very different. But that’s not the focus of this article. Instead of going step-by-step through training a specific algorithm or neural network, this article aims to give you a general overview of machine learning.

Artificial Intelligence (AI)

At first, people wanted to automate their work, often because humans tend to look for easier ways to do things. So they built machines. Later, they wanted these machines to think and make decisions by themselves, which led to creating algorithms that gave machines a kind of intelligence.

Programmers created these algorithms with basic logical functions to solve certain problems. Because of this, many believed that a machine could never be smarter than the person who programmed it, and back then, that was true. If a programmer made mistakes, the machine would make the same mistakes.

Note: AI isn’t always this simple. I’m just making things easier to understand before we get into machine learning.

Areas that use AI

Areas that use AI (source: legalexecutiveinstitute.com)

Machine Learning

Eventually, people tried something new: teaching machines to learn. Instead of writing out all the decision rules, you give data to an algorithm and let it figure out how to make decisions. The machine learns from examples and experience, instead of just following set rules.

Tom M. Mitchell gave a formal definition of “machine learning” in his book Machine Learning (Mitchell, T. (1997). McGraw Hill):

“A computer program is said to learn from experience E with some class of tasks T and performance measure P if its performance at tasks in T, as measured by P, improves with experience E.”

Let me try to unpack this with an example. Suppose you wrote a program to guess the gender of a person from a photo. In that context:

  • E: the experience gathered from making these guesses
  • P: an equation that measures how well the program performs
  • T: the task of guessing the gender from a given image

Gender detection demo

Gender detection (source: dlology.com)

First, you would collect a set of images of people and label each one with its gender. Then you give these images to your program, which tries to guess the gender. Using your performance metric P, you check how well the program did. You repeat this process by giving it more images and checking its performance again. If the program gets better over time, it fits Mitchell’s definition of a real “machine learning program.”

Today, machine learning is used in many places to help make decisions easier. For example, Google uses machine learning to:

  • Identify spam emails
  • Predict what you like based on your searches so that it can show relevant ads
  • Personalize search results
  • Find similar images in image search
  • Extract text from images, in both image search and Google Translate
  • Detect faces in Google Photos and identify each person
  • Automatically apply filters to images
  • Power Google Assistant

These are just a few examples of how Google uses machine learning to make things better for users.

Types of Machine Learning

A machine learning program needs data in order to learn. As mentioned before, you usually have to clean and prepare this data first to get better results. Once your data is ready, you use it to train your machine learning program. There are three main types of machine learning tasks, based on how they are trained:

  1. Supervised learning
  2. Unsupervised learning
  3. Reinforcement learning

Supervised Learning

This is one of the most popular and easiest ways to train a machine learning program. It needs labeled data. For example, if you want to tell whether an image shows a dog or not, you need a set of images, each labeled as “dog” or “not dog.”

You’d end up with a set of images (xx) and their labels (yy). The machine learning program’s job is to find a function ff that can assign the correct label to a given image, such that:

y=f(x)y = f(x)

Supervised learning can be split into two main categories:

  1. Classification
  2. Regression

Classification and regression

Types of supervised learning (source: towardsdatascience.com)

The dog example above is a classification problem. Spam detection, image classification, and activity detection are a few more examples. The key idea is that a classification problem has a fixed set of classes (categories), and the program’s job is to determine which category a given piece of data falls into.

Age detection and stock price prediction are examples of regression problems. Unlike classification, regression requires the program to output an exact number. In age detection, for instance, the program has to predict a person’s age in years from a photo.

Regression vs classification

Regression vs classification (source: medium.com)

Some of the algorithms that use supervised learning as their training method:

  • Support Vector Machines
  • Linear regression
  • Logistic regression
  • Naive Bayes
  • Linear discriminant analysis
  • Decision trees
  • K-nearest neighbor algorithm
  • Neural Networks
  • Similarity learning

Unsupervised Learning

Unsupervised learning is different from supervised learning because it uses data that has not been labeled, sorted, or grouped. In this case, we only have input data (xx) and no matching output (yy). Unsupervised learning looks for patterns in the data and responds to whether those patterns show up in new data.

Unsupervised learning is mainly used for clustering, feature learning, and density estimation. The main idea is to learn the common features of the input data so it can be grouped or classified.

Example for an unsupervised learning problem

Example for an unsupervised learning problem (source: towardsdatascience.com)

In the example above, the goal is to sort images of ducks, rabbits, and mice. During training, we do not tell the algorithm which image belongs to which group. Instead, it figures out the class of each image by itself as it learns.

Because these algorithms learn the common features of the data by themselves, they’re also well-suited for exploratory analysis and dimensionality reduction.

Some of the main algorithms used in unsupervised learning:

  • Clustering
    • hierarchical clustering
    • k-means
    • mixture models
    • DBSCAN
    • OPTICS algorithm
  • Neural Networks
    • Autoencoders
    • Deep Belief Nets
    • Hebbian Learning
    • Generative Adversarial Networks
    • Self-organizing map

Supervised vs unsupervised learning

Supervised vs unsupervised learning (source: differencebetween.net)

Reinforcement Learning

This method is a mix of supervised and unsupervised learning. Like supervised learning, it uses both input and output data, but here the input is called an action and the output is called a reward. It is not fully supervised because it does not just use labeled training data, and it is not unsupervised because every action gets a reward. The main goal of reinforcement learning is to find the best action in each situation to get the highest total reward.

Reinforcement learning

Reinforcement learning (source: becominghuman.ai)

In this example, the mouse can take one of four actions: go left, right, forward, or back. For each action, the algorithm gives the mouse a reward of -1. If the mouse eventually finds the cheese, it receives a much bigger reward, say 10000.

The goal is to reach the cheese in as few moves as possible. Since every action costs a -1 reward, the algorithm learns to find the most efficient path to the cheese.

Basic reinforcement learning algorithms are built on the Markov decision process.

Read the next article in this series, which covers neural networks and deep learning.

Filed Under

Join the Conversation

This dispatch is part of an ongoing series on the future of intelligence. Share your perspective or subscribe for more.

Weekly dispatches. No spam. Ever.