How Does a Machine "Learn"?
In this video, Elle O'Brien, Lecturer in the School of Information, explains how AI systems are trained and the importance of fine-tuning data to create accurate predictive models.
Transcript
So we've talked a bit about how there's this word, "machine learning," and you might hear about machine learning systems or AI systems that learn or they train. When you think of that, if you're like me, maybe the sort of pictures that come to mind are like an athlete who’s learning how to use their body in the most effective ways. They’re training, gaining knowledge of how their body works. Or perhaps a child who’s learning how to read and write. I have these very embodied, physical, and very human associations with these words.
But, as with many things that we’ll see in AI, we actually need some new pictures to think about how AI works. Now, there’s not just one technique in AI. There are several, but I’m going to show you one that’s very common. I think this is a good one to have in mind when you think about a lot of AI systems.
Let’s have a little example here. Remember Melvin, who we met in our first two courses? Melvin is my chicken, and Melvin likes cookies and milk. He loves to eat cookies and milk at snack time. But we want to make a prediction. If we know how many cookies Melvin has eaten, I want to be able to plan how much milk he's going to need. Melvin likes eating cookies, but they make him thirsty. So, to ensure I have enough milk on hand for him every snack time so he doesn’t get grumpy, I want to know, based on how many cookies I’ve got to serve him that day, how much milk is Melvin going to need?
Our prediction problem is: If I know how many cookies Melvin is going to have, how much milk will he need? I can collect some data on this. Here, I’ve collected data for 10 snack times where I watched Melvin eat cookies. Every day, I log how many cookies he’s eaten, which is on the x-axis, and on the y-axis, I have how many sips of milk he had. It looks like there’s a general trend: if he’s eating very few cookies, he doesn’t need that much milk, but if he eats a lot of cookies, he needs more milk. So, generally, the more cookies he eats, the more milk he wants, and that seems to make sense.
Something we can do with this data is use a model to try to capture the pattern that we’ve seen. You might have some associations with the word "model." In this case, what we mean is that I’m going to take this shape, this line, and I’m going to say, "Okay, how can I use this line to fit the data?" We’re looking for the best fit. So, I’m going to go back and do that one more time for you. We could fit it this way—not so good—or fit it this way—eh. And there we go; that looks like a pretty good model.
What do I mean by a pretty good model? I mean that we’re trying to minimize how far away each of those data points is from this blue line, from our model. We want to get as close as possible to all of those points. The solid blue line here is a model of the observations that we’ve seen so far. It represents a pattern in the data. It captures the sense that as more cookies are being eaten, we need more milk. It’s a line that goes up with the number of cookies.
This is an example of what training can look like for an AI system. Many of them are more complicated than this, but a surprising amount of it can look like this. It’s where we take some data and say, "Okay, I’m going to fit a model. I’m going to fit something like this line to that data." We look at the data we have so far and see how to fit this as best as possible, how to describe it as best as possible. This is an example of training.
To recap, we started with data, then did some training where we looked at the best way for that line to look. If I know I’m trying to describe the data with a line, how do I want that line to look? After training, we find the best one, the best possible fit, and that’s our resulting model.
Here’s how learning really can mean something quite particular. Fitting a line is something that would be called learning in machine learning. But that’s not really what I would think of as learning in my everyday life. If one of my friends told me they were learning a new language, this word is being used in some different ways here.
Instead of thinking like this, I think it’s often helpful to think of AI systems that learn as doing more of a tuning. We start with the idea that there’s some line that’s going to fit this data, and we’re looking for how exactly to tune that line. How do we tilt it? How do we shift it so that it’s going to best fit our data? It’s more of a tuning process than related to what I would describe in my everyday life as learning.
Again, I want to caution that this is just one example. It’s not the only type of learning that can occur, but this is a really, really common one.