Machine Learning is the ability of machines to learn from data without being programmed. This is used on a daily basis in platforms such as Netflix, Spotify or voice assistants like Siri.
Through the following case of how to differentiate wine from beer, Google Cloud Platform presents us: The 7 steps of Machine Learning.
From detecting skin cancer, to sorting cucumbers, to detecting when escalators need to be repaired.
Machine Learning has given computer systems entirely new abilities, but how does it really work in depth?
Let’s look at a basic example and use it as an excuse to talk about the process of getting answers, through your data using machine learning.
Welcome to the adventures of AI in the cloud! My name is Yu Feng Guo and in this program we will explore the art, science and tools of machine learning.
Suppose we have been asked to create a system that answers the question of whether a certain 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 data that allows it to train. This is where we start.
¿Wine or beer?
Our data will be collected from wine and beer glasses. There are many aspects of the beverages that we could collect, from the amount of foam to the shape of the glasses. For our purposes, we will just pick a couple of simple pieces of data, the color, as a wavelength of light and the alcohol content, as a percentage.
What we are looking for is to be able to divide these two types of beverages into two factors. From now on we will call these our characteristics: color and alcohol.
The first step in our process will be to go to the local store to buy many different beverages and get the equipment to measure them. A spectrometer, to measure color, and a densimeter, to measure alcohol. It looks like our store also has an electronics section.
Once we have the equipment and the alcohol all in place, it’s time for our first real machine learning step: collecting that data. This is very important, because the quality and quantity of the data collected, will directly determine how good the predictive model can be and the data we collect will be the color and alcohol content of each drink.
This will be our training data, so a few hours of measurements later maybe we will have a few drinks and now is the time.
Now it’s time to collect the training data:
We load our data into a suitable place and prepare it for use by our machine learning training.
First we gather all the data, in random order. We don’t want the order of the data to affect what we learn, as it won’t be determinative of whether a drink is wine or beer.
This is also a good time to visualize the data, to help see if there are relevant relationships between the variables that can be engaged, as well as to show if there is inconsistency in the data.
For example, if we collect many more data points on beer than on wine, the model we train will be strongly predisposed to guess that virtually everything it sees is beer, since it would be right most of the time. However, in the real world, the model may see beer and wine in an equal amount, which would mean that it would be guessing wrong about beer half the time which we also need.
Also, we need to split the data into two parts, the first part used in training our model will be the bulk of our data. The second will be used to evaluate our model.
Maybe we would like to use the questions from the math one in the math exam, sometimes the data we collect need other ways to fit, manipulate things normalization error, duplication, error correction and others.
Workflow: Choosing a model
The next step in our workflow is to choose a model. There are many models that researchers and data scientists have created over the years, some are well suited for image data, some for sequences like text or music, some for numeric data and some for text based data. In our case we are looking at two features, color and alcohol percentage, we can use the small linear model simply and it should do its job.
Training
In this step we will use our data to predict whether a drink is wine or beer, this is similar to someone learning to drive. At first you will not know how the pedals and knobs work. However, after a lot of practice that person has become adept at driving and reacting to real world data.
We will do this to scale our particular drinks, the formula for a straight line is y equals MX plus B: where X is the input; M is the slope of the line; B is the intersection with the y-axis; and Y is the value of the line at that X position. The values we have available for us to adjust or train are only N and P: where M is that slope; and B is the intersection with the y-axis. There is no other way for the ascites to affect the position of the line, since the only other variables are X our input and Y, our output.
Review the learning formula here.
How do we continue?
The power of machine learning, in this example, was to differentiate between wine and beer, instead of using human thinking and manual rules. Also, we can use the ideas presented today in other problems, where the same principles apply in the following steps:
Collect data.
Prepare the data.
Choose the model.
Train.
Evaluate.
Adjust parameters.
Predict.