Intro to Machine Learning (ML Zero to Hero - Part 1)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
♪ (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 <i>Rock, Paper, Scissors</i>. 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 <i>X</i> and <i>Y</i> values. Can you see it? It's actually <i>Y = 2X - 1.</i> So if you saw it, how did you get that? Maybe you noticed that the <i>Y</i> value increases by 2, while the <i>X</i> value only increases by 1. So it was <i>Y = 2X </i> plus a minus something. And then, you may have seen that when <i>X</i> was zero, <i>Y</i> was minus one, so you figured <i>Y = 2X - 1</i> 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 <i>keras.layers.Dense</i> code. And that layer has a single neuron in it, indicated by <i>units = 1.</i> We also feed a single value into the neural network, which is the <i>X</i> value, and we'll have the neural network predict what the <i>Y</i> would be for that <i>X.</i> So that's why we just say that <i>input_shape</i> is one value. When you compile the model, there are two functions: the <i>loss</i> and the <i>optimizer.</i> 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 <i>Y = 5X + 5</i>. And when training, it will then calculate how good or how bad that guess is, using the <i>loss</i> function. And then, it will use the <i>optimizer</i> 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 <i>optimizer</i> to enhance that guess, and so on. The data itself is set up as an array of <i>Xs</i> and <i>Ys,</i> and our process of matching them to each other is in the <i>fit</i> method of the model. We literally say, "<i>fit</i> the <i>Xs</i> to the <i>Ys</i> and try this 500 times." When it's done, we'll have a trained model. So now you can try to predict a <i>Y</i> value for a given <i>X.</i> What do you think would happen if you tried this line of code predict the <i>Y</i> when <i>X</i> 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 <i>subscribe</i> button. Thank you! ♪ (music) ♪
Info
Channel: TensorFlow
Views: 577,037
Rating: 4.9692478 out of 5
Keywords: Coding TensorFlow, Machine learning zero to hero, zero to hero, intro to ML, ML, machine learning, ML model python, python language, AI, artificial intelligence, AI advocate, code for machine learning, machine learning code, TensorFlow, tensorflow coding, tf coding, Laurence Moroney, GDS: Yes;
Id: KNAWp2S3w94
Channel Id: undefined
Length: 7min 17sec (437 seconds)
Published: Fri Aug 30 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.