Saltar al contenido

English

The 7 steps of machine learning

Guns · 03 de febrero de 2021 · 4 min de lectura

Machine learning is the ability of machines to learn from data without being explicitly programmed…

Illustration of a human head surrounded by letters

Machine learning is the ability of machines to learn from data without being explicitly programmed. It is used daily on platforms such as *Netflix*, *Spotify* and voice assistants such as *Siri*.

Using the example of distinguishing wine from beer, *Google Cloud* introduces the 7 steps of machine learning.

Watch the video

Read the video transcript

You can enable captions on *YouTube* under Settings > Subtitles/CC, or read the transcript below:

From detecting skin cancer to sorting cucumbers or identifying when escalators need repairs, machine learning has given computer systems entirely new abilities. But how does it actually work?

Let's look at a basic example and use it to explore the process of getting answers from data through machine learning.

Welcome to AI Adventures in the cloud! My name is Yufeng Guo, and in this series we explore the art, science and tools of machine learning.

Suppose we are asked to build a system that answers whether a particular drink is wine or beer. We call this question-answering system a model, and it is created through a process called machine learning training.

The goal of machine learning is to create an accurate model that answers our questions correctly most of the time. To train a model, we need to collect training data. That is where we begin.

Wine or beer?

We will collect data from glasses of wine and beer. There are many aspects we could measure, from the amount of foam to the shape of the glass. For our purposes, we will choose just two simple measurements: color, as a wavelength of light, and alcohol content, as a percentage.

We want to distinguish these two types of drinks using those two factors. From now on, we will call color and alcohol our features.

Our first step is to visit the local shop, buy many different drinks and obtain equipment to measure them: a spectrometer for color and a hydrometer for alcohol. It seems our shop also has an electronics section.

Once the equipment and drinks are ready, it is time for our first real machine learning step: collecting data. This matters because the quality and quantity of data directly determine how good the predictive model can be. We will collect the color and alcohol content of each drink.

These will be our training data. After a few hours of measurements—and perhaps a few drinks—it is time to move on.

Now it is time to gather the training data

We load our data into a suitable place and prepare them for machine learning training.

First, we put all the data together in random order. We do not want the order to affect what we learn, since it should not determine whether a drink is wine or beer.

This is also a good time to visualize the data, identify useful relationships between variables and spot inconsistencies.

For example, if we collect far more data points for beer than wine, our model will be strongly biased toward guessing that almost everything is beer, because that would be correct most of the time. In the real world, however, the model might encounter equal amounts of beer and wine, meaning it would incorrectly guess beer half the time.

We also need to split the data into two parts. The larger part will train the model, and the second will evaluate it.

As with separating practice questions from a mathematics exam, collected data may also need other preparation: normalization, handling duplicates, correcting errors and other adjustments.

Workflow: choosing a model

The next step is to choose a model. Researchers and data scientists have developed many models over the years. Some suit image data, others sequences such as text or music, some numerical data and others text-based data. In our case, with two features—color and alcohol percentage—a simple linear model should do the job.

Training

In this step, we use our data to predict whether a drink is wine or beer. It is similar to learning to drive. At first, a person does not know how the pedals and controls work. With practice, they become skilled at driving and responding to real-world information.

For our drinks, the equation of a straight line is y = mx + b, where x is the input, m is the slope, b is the y-intercept and y is the line's value at that x position. The values we can adjust, or train, are m and b: the slope and the y-intercept. Those determine the line's position, while x is the input and y the output.

Review the learning formula here.

How do we continue?

In this example, machine learning distinguishes wine from beer instead of relying on human reasoning and hand-written rules. We can apply these ideas to other problems using the same principles and steps:

  • Gather data.
  • Prepare the data.
  • Choose a model.
  • Train.
  • Evaluate.
  • Tune the parameters.
  • Predict.