Machine Learning Algorithm != Learning Machine
JeanFrancoisPuget 2700028FGP Comments (9) Visits (72674)
How easy it is to build a learning machine? Shouldn't one just hire some Machine Learning PhDs and have them run their algorithms? Well, this is most probably a good idea, but it won't be enough. I'll try to explain why in this blog entry.
Before answering our questions, let's define what we are dealing with.
A Learning Machine is a machine (a software, a web site, a mobile app, a robot, pick your favorite) that performs a task, and that gets better and better as it performs it. In recent years, some learning machines made headlines. For instance, IBM Watson defeated best humans at Jeopardy few years ago. IBM Watson is a learning machine (we like to say a cognitive machine at IBM). It was given Wikipedia to digest, then it was trained with pairs of question answers from Jeopardy. As it trained, its performance at answering Jeopardy questions improved until it was able to best top human players. More recently, Google AlphaGo won a match against one of the top Go players. AlphaGo is also a learning machine. It was first trained on a large set of recorded Go games between top players. Then it trained against itself. As it trained, its performance at Go increased, until it became better than a top Human player.
These are two well-known examples of learning machines, but there are many more learning machines around us.
Machine Learning is harder to define. One would think that it is the study of what it takes to build learning machines. It started that way, but the machine learning community is mostly focusing on the development and on the application of machine learning algorithms. A machine learning algorithm takes some data as input, and it produces a model of that data as output. That model can then be used to make predictions out of unforeseen data.
Let's give a simple example for the sake of clarity. Assume you want to build a learning machine that learns how to price houses for sale. You train it with data about past sales. Let's say we get for each sale the price, and various information about the house: its location, its surface, its number of rooms, the presence of a pool, the number of floors, etc. In that case we would use a supervised learning algorithm. We say supervised because we know in advance the task that needs to be learned: predict house price.
Our supervised learning algorithm will compute a model that relates the price of houses to the rest of the data we have for the house. A simple model could be:
price = 100 * surface + 20,000 * pool + 15,000 * num_room
Models like this, where the target variable (here the price) is a linear combination of other variables, are produced by regression algorithms. Other machine learning algorithms such as decision trees, or deep learning, would produce more complex models. Whatever the model complexity, the purpose is the same: make predictions on new data. For instance, when we get a new house, say with 2,000 sq. feet, 3 rooms, and no pool, we can compute a price:
price = 100 * 2,000 + 20,000 * 0 + 15,000 * 3 = 245,000
We just made a prediction. It is a prediction because it is not the price at which the house will be sold. It is our best guess given the model we built out of the history data we have access to. Another model might produce a different prediction.
Machine Learning workflow
Let me recap: we ingested data (past sales information), we built a model of that data using a machine learning algorithm, then we used that model to make a prediction using new, unforeseen, data. The machine learning workflow looks like this:
How should we chose our model? The answer is simple: the quality of a model boils down to the quality of the predictions we can make using it. Issue is that we don't know the prediction quality when we build the model. Indeed, we don't know in advance what are the future house for sales, hence we cannot make predictions when all we have is history data. Understanding what makes a good model before you start making predictions is a difficult task. There are techniques for it (e.g. cross validation), but this is beyond the scope of this post.
If we used a good algorithm and selected the right model, then we should be able to get good predictions. Does it mean we have a machine that learns how to predict house prices? No, by far.
Sure, we have a machine learning algorithm that creates a model from data. But where does this data come from? We need to get it from somewhere. And whatever the data source, data is probably not in the right form. And it may have quality issues, e.g. missing or incorrect values (typos). For these reasons, and other reasons, we need to include a data preparation step before we train a model. Similarly, it is not because we have a model that we can predict: we need data to make the prediction! We therefore need to deploy the model in a production environment where new data are ingested. The workflow becomes a bit more complex:
Does this get us a learning machine? Not yet.
One issue is that all the steps above need to be fully automated before we can even think of a learning machine. Automating these steps isn't easy in general. One of the issue is to be able to evaluate the future performance of a model. Indeed, it is not enough to produce a model, we want to produce a model that can produce good predictions. Another issue is that of data preparation. It is hard to define in advance all the weirdness that can happen in data. I could go on forever, but let's assume for the sake of discussion that we can automate all of this.
Do we get a learning machine? Not yet, but we're getting closer.
Learning from feedback
What we have is a machine that learns once. Indeed, it learns from the input data, but it stops learning after. We would like to be able to have it learn as the housing market evolves. The cure for that is to repeat the training on a regular basis, for instance every month. We would train a new model using additional data coming from last month sales.
Note that training can be time consuming, and it seems silly to start from scratch each time. Fortunately, there are machine algorithms that are incremental: they can start from an existing model when they are trained with additional data, cutting training time significantly.
In a similar vein, our machine does not learn from its mistakes. Let's say it constantly predicts a price higher than the actual sales price. Shouldn't it learn to revise the way it makes predictions? We can cure this issue and the previous issue at once by adding a feedback ingestion loop to our machine. We need monitor what happens out of our predictions, so that we can compare the actuals with the prediction, and use it as further data for a new training of the machine. For instance, we can collect the actual price of a sale together with the predicted price, and feed it back to our machine. This would produce a new model that can be deployed to make new predictions. The workflow becomes:
The loop can then be repeated as we go.
Implementing the above requires the automation of the monitoring step and the feedback ingestion step. Assuming this is done, do we have a learning machine? I'd say we're pretty close to it.
What remains to be automated is the acting part: what happens out of predictions? Ideally, predictions are used in a system that can act, for instance play Jeopardy or play Go. When acting is automated, then the above loop can be fully automated, and it can be executed continuously. In that case we do have a learning machine.
Note that the loop can be executed as often as possible. We can even repeat it after each prediction if the machine executes fast enough. In that case, effect of each prediction is monitored and the feedback is ingested at once, leading to a new training, before the next prediction occurs. Machines performing this kind of learning are called online learning machines.
We can now answer our questions. Yes, machine learning algorithms are required to build a learning machine. They are at the heart of it. But they aren't enough. We need to automate a complete flow that goes from data to predictions. We also need to automate a complete flow that works the reverse way, collecting feedback from the effect of predictions in order to further train the machine. In a nutshell, machine learning algorithms are necessary for learning machines, but they are not sufficient. This is why a machine learning algorithm is not the same as a learning machine.