字幕表 動画を再生する 英語字幕をプリント ♪ (music) ♪ You've probably heard a lot about AI machine learning over the last few months. And maybe you've been inspired by videos showing what's possible with AI machine learning. But what is it really? Once you go beyond the hype and get down to writing code, what does AI really look like? Well, that's what we're going to go through in this video series, where we'll teach you what it's like to write code for machine learning, and how it provides different, new, and exciting scenarios that will help you write applications that behave more like a human being, giving you artificial intelligence. I'm Laurence, and I'm going to be your guide. You don't need to know a lot to get started, and we'll be using the Python language. Don't worry if you've never used it, it's super simple to understand, and you'll be up and running in no time. So let's start with a very simple example. Consider you're creating a game of Rock, Paper, Scissors. When you play this with a human, it's very basic; every child can learn it in just a few minutes. Now, let's take a look at the most basic part of a game that the human brain is really good at, and that's recognizing what it's actually looking at. So consider these images. Most people can look at them and instantly recognize which ones are rock, which ones are paper, and which ones are scissors. But how would you program a computer to recognize them? Think about all of the diversity of hand types, skin color, and even people who do scissors like me, with their thumb sticking out, and people who do scissors with their thumb in. If you've ever written any kind of code, you'll instantly realize that this is a really, really difficult task. It might take you thousands or tens of thousands of lines of code, and that's just to play rock, paper, or scissors. So what if there was a different way to teach a computer to recognize what it sees? What if you could have a computer learn in the same way that a human does? That's the core of machine learning and the path to artificial intelligence. So traditional programming looks like this. You have data, for example, a feed from the webcam, and you have rules that act on this data. These rules are expressed in a programming language and are the bulk of any code that you write. Ultimately, these rules will act on the data and give you an answer. Maybe it sees a rock, maybe it sees a paper, and maybe it sees scissors. But what if you turn this diagram around, and instead of you as the programmer figuring out the rules, you instead give it answers with the data and have the computer figure out what the rules are. That's machine learning. So now, I can have lots of pictures of rocks and tell a computer that this is what a rock looks like, and this is what paper looks like, and this is what scissors looks like. And I can have a computer figure out the patterns that match them to each other. Then, my computer will have learned to recognize a rock, paper, and scissors. That's the core of building something that uses machine learning. You get a set of data that has patterns inherent in it, and you have a computer learn what those patterns are. Before we write a neural network that learns something as complex as rock, paper, and scissors, let's use a much simpler example. Take a look at these numbers-- there's a relationship between the X and Y values. Can you see it? It's actually Y = 2X - 1. So if you saw it, how did you get that? Maybe you noticed that the Y value increases by 2, while the X value only increases by 1. So it was Y = 2X plus a minus something. And then, you may have seen that when X was zero, Y was minus one, so you figured Y = 2X - 1 would be a good guess, and then you took a look at the other numbers and saw that it worked. That's exactly the principle that all machine learning works on. So let's take a look. This is the entire code that you can use to create a machine-learned model that figures out what matches these numbers to each other. Don't worry if some of it doesn't look very familiar right now, you'll be able to pick that up in no time. This first line defines the model itself. A model is a trained neural network, and here we have the simplest possible neural network, which, in this case, is a single layer indicated by the keras.layers.Dense code. And that layer has a single neuron in it, indicated by units = 1. We also feed a single value into the neural network, which is the X value, and we'll have the neural network predict what the Y would be for that X. So that's why we just say that input_shape is one value. When you compile the model, there are two functions: the loss and the optimizer. These are the key to machine learning. How machine learning works is that the model will make a guess about the relationship between the numbers. For example, it might guess that Y = 5X + 5. And when training, it will then calculate how good or how bad that guess is, using the loss function. And then, it will use the optimizer function to generate another guess. The logic is that the combination of these two functions will slowly get us closer and closer to the correct formula. And, in this case, it will go through that loop 500 times, making a guess, calculating how accurate that guess is, and then using the optimizer to enhance that guess, and so on. The data itself is set up as an array of Xs and Ys, and our process of matching them to each other is in the fit method of the model. We literally say, "fit the Xs to the Ys and try this 500 times." When it's done, we'll have a trained model. So now you can try to predict a Y value for a given X. What do you think would happen if you tried this line of code predict the Y when X equals 10? You might think that the answer is 19, right? But it isn't. It's actually something like 18.9998. It's close to 19, but it's not quite there. Why do you think that would be? Well, the computer was trained to match only six pairs of numbers. It looks like a straight-line relationship between them, for those six, but it may not be a straight line for values outside of those six. There's a very high probability that it's a straight line, but we can't be certain. And this probability is built into the prediction, so it's telling us a value very close to 19, instead of exactly 19. Try the code out using the link in the description below this video to see it for yourself. This is something you'll see a lot more of in machine learning. And in the next video in this series, we'll take what you've learned and apply that to a more interesting problem-- computer vision-- and seeing how you can teach a computer to see things, using exactly the same methodology as you used here. We'll see you in that video, and don't forget to hit that subscribe button. Thank you! ♪ (music) ♪
A2 初級 機械学習入門(MLゼロからヒーローへ、その1 (Intro to Machine Learning (ML Zero to Hero, part 1)) 5 1 林宜悉 に公開 2021 年 01 月 14 日 シェア シェア 保存 報告 動画の中の単語