PyTorch Deep Learning
Transcript
This comprehensive course will teach you the foundations of machine learning and deep learning using PyTorch. PyTorch is a machine learning framework written in Python. You'll learn machine learning by writing PyTorch code. So when in doubt, run the provided code and experiment. Your teacher for this course is Daniel Bourke. Daniel is a machine learning engineer and popular course creator. So enjoy the course and don't watch the whole thing in one sitting. Hello, welcome to the video. It's quite a big one. But if you've come here to learn machine learning and deep learning and PyTorch code, well, you're in the right place. Now, this video and tutorial is focused for beginners who have got about three to six months of Python coding experience. So we're going to cover a whole bunch of important machine learning concepts by writing PyTorch code. Now, if you get stuck, you can leave a comment below or post on the course
GitHub discussions page. And on GitHub is where you'll be able to find all the materials that we cover, as well as on learn pytorch.io. There's an online readable book version of this course there. But if you finish this video and you find that, hey, I would still like to learn more PyTorch. I mean, you can't really cover all the PyTorch in a day that video titles just apply on words of the length of video. That's an aside. There is five more chapters available at learn pytorch.io, covering everything from transfer learning to model deployment to experiment tracking. And all the videos to go with those are available at zero to mastery.io. But that's enough for me. Having machine learning and I'll see you inside.
Hello, my name is Daniel and welcome to the deep learning with PyTorch course. Now, that was too good not to watch twice. Welcome to the deep learning with cools at fire PyTorch course. So this is very exciting. Are you going to see that animation quite a bit because, I mean, it's fun and PyTorch's symbol is a flame because of torch. But let's get into it. So naturally, if you've come to this course, you might have already researched what is deep learning, but we're going to cover it quite briefly. And just in the sense of how much you need to know for this course, because we're going to be
more focused on, rather than just definitions, we're going to be focused on getting practical and seeing things happen. So if we define what machine learning is, because as we'll see in a second, deep learning is a subset of machine learning. Machine learning is turning things data, which can be almost anything, images, text, tables of numbers, video, audio files, almost anything can be classified as data into numbers. So computers love numbers, and then finding patterns in those numbers. Now, how do we find those patterns? Well, the computer does this part specifically a machine learning algorithm or a deep learning algorithm of things that we're going to be building in this course. How? Code and math. Now, this course is code focused. I want to stress that before you get into it. We're focused on writing code. Now, behind the scenes, that code is going to trigger some math to find patterns in
those numbers. If you would like to deep dive into the math behind the code, I'm going to be linking extra resources for that. However, we're going to be getting hands on and writing lots of code to do lots of this. And so if we keep going to break things down a little bit more, machine learning versus deep learning, if we have this giant bubble here of artificial intelligence, you might have seen something similar like this on the internet. I've just copied that and put it into pretty colors for this course. So you've got this overarching big bubble of the topic of artificial intelligence, which you could define as, again, almost anything you want. Then typically, there's a subset within artificial intelligence, which is known as machine learning, which is quite a broad topic. And then within machine learning, you have another topic called deep learning. And so that's what we're going to be focused on working with PyTorch,
writing deep learning code. But again, you could use PyTorch for a lot of different machine learning things. And truth be told, I kind of use these two terms interchangeably. Yes, ML is the broader topic and deep learning is a bit more nuanced. But again, if you want to form your own definitions of these, I'd highly encourage you to do so. This course is more focused on, rather than defining what things are, is seeing how they work. So this is what we're focused on doing.
Just to break things down, if you're familiar with the fundamentals of machine learning, you probably understand this paradigm, but we're going to just rehash on it anyway. So if we consider traditional programming, let's say you'd like to write a computer program that's enabled to, or has the ability to reproduce your grandmother's favorite or famous roast chicken dish. And so we might have some inputs here, which are some beautiful vegetables, a chicken that you've raised on the farm. You might write down some rules. This could be your program, cut the vegetables, season the chicken, preheat the oven, cook the chicken for 30 minutes and add vegetables. Now, it might not be this simple, or it might actually be because your Sicilian grandmother is a great cook. So she's put things into an art now and can just do it step by step. And then those inputs combined with those rules makes this beautiful roast chicken dish. So that's traditional programming. Now,
a machine learning algorithm typically takes some inputs and some desired outputs and then figures out the rules. So the patterns between the inputs and the outputs. So where in traditional program, we had to hand write all of these rules, the ideal machine learning algorithm will figure out this bridge between our inputs and our idealized output. Now, in the machine learning sense, this is typically described as supervised learning, because you will have some kind of input with
some kind of output, also known as features, and also known as labels. And the machine learning algorithm's job is to figure out the relationships between the inputs or the features and the outputs or the label. So if we wanted to write a machine learning algorithm to figure out our Sicilian grandmother's famous roast chicken dish, we would probably gather a bunch of inputs of ingredients such as these delicious vegetables and chicken, and then have a whole bunch of outputs of the finished product and see if our algorithm can figure out what we should do to go from these inputs to output. So that's almost enough to cover of the difference between traditional programming and machine learning as far as definitions go. We're going to get hands on encoding these sort of algorithms throughout the course. For now, let's go to the next video and ask the question, why use machine learning or deep learning? And actually, before we get there, I'd like you to
think about that. So going back to what we just saw, the paradigm between traditional programming and machine learning, why would you want to use machine learning algorithms rather than traditional programming? So if you had to write all these rules, could that get cumbersome? So have a think about it and we'll cover it in the next video. Welcome back. So in the last video, we covered briefly the difference between traditional programming and machine learning. And again, I don't want to spend too much time on definitions. I'd rather you see this in practice. And I left you with the question, why would you want to use machine learning or deep learning? Well, let's think of a good reason. Why not? I mean, if we had to write all those handwritten rules to reproduce Alsace and grandmother's
roast chicken dish all the time, that would be quite cumbersome, right? Well, let's draw a line on that. Why not? What's a better reason? And kind of what we just said, right? For a complex problem, can you think of all the rules? So let's imagine we're trying to build a self-driving car. Now, if you've learned to drive, you've probably done so in maybe 20 hours, 100 hours. But now, I'll give you a task of writing down every single rule about driving. How do you back out of your driveway? How do you turn left and go down the street? How do you park a reverse park? How do you stop at an intersection? How do you know how fast to go somewhere? So we just listed half a dozen rules. But you could probably go a fair few more. You might get into the thousands. And so for a complex problem, such as driving, can you think of all the rules? Well, probably not. So that's where machine learning and deep learning come in to help. And so this is a beautiful comment
I like to share with you on one of my YouTube videos is my 2020 machine learning roadmap. And this is from Yashawing. I'm probably going to mispronounce this if I even try to. But Yashawing says, I think you can use ML. So ML is machine learning. I'm going to use that a lot throughout the course, by the way. ML is machine learning, just so you know. For literally anything, as long as you can convert it into numbers, ah, that's what we said before, machine learning is turning something into computer readable numbers. And then programming it to find patterns, except with a machine learning algorithm, typically we write the algorithm and it finds the patterns, not us. And so literally it could be anything, any input or output from the universe. That's pretty darn cool about machine learning, right? But should you always use it just because it could be used for anything? Well, I'd like to also introduce you to Google's number one rule
of machine learning. Now, if you can build a simple rule based system such as the step of five rules that we had to map the ingredients to our Sicilian grandmothers roast chicken dish, if you can write just five steps to do that, that's going to work every time, well, you should probably do that. So if you can build a simple rule based system that doesn't require machine learning, do that. And of course, maybe it's not so very simple, but maybe you can just write some rules to solve the problem that you're working on. And this is from a wise software engineer, which is, I kind of hinted at it before, rule one of Google's machine learning handbook. Now, I'm going to highly recommend you read through that, but we're not going to go through that in this video. So check that out. You can Google that otherwise the links will be where you get links. So just keep that in mind, although machine learning is very powerful and very fun and very
excited, it doesn't mean that you should always use it. I know this is quite the thing to be saying at the start of a deep learning machine learning course, but I just want you to keep in mind, simple rule based systems are still good. Machine learning isn't a solve all for everything. Now, let's have a look at what deep learning is good for, but I'm going to leave you on a clip hammock because we're going to check this out in the next video. See you soon. In the last video, we familiarized ourselves with Google's number one rule of machine learning, which is basically if you don't need it, don't use it. And with that in mind, what should we actually be looking to use machine learning or deep learning for?
Well, problems with long lists of rules. So when the traditional approach fails to remember the traditional approach is you have some sort of data input, you write a list of rules for that data to be manipulated in some way, shape, or form, and then you have the outputs that you know. But if you have a long, long list of rules, like the rules of driving a car, which could be hundreds, could be thousands, could be millions, who knows, that's where machine learning and deep learning may help. And it kind of is at the moment in the world of self-driving cars, machine learning and deep learning are the state of the art approach.
Continually changing environments. So whatever the benefits of deep learning is that it can keep learning if it needs to. And so it can adapt and learn to new scenarios. So if you update the data that your model was trained on, it can adjust to new different kinds of data in the future. So similarly to if you are driving a car, you might know your own neighborhood very well. But then when you go to somewhere you haven't been before, sure you can draw on the foundations of what you know, but you're going to have to adapt. How fast should you go? Where should you stop? Where should you park? These kinds of things. So with problems with long lists of rules, or continually changing environments, or if you had a large, large data set. And so this is where deep learning is flourishing in the world of technology. So let's give an example. One of my favorites is the food 101 data set, which you can search for online, which is images of 101
different kinds of foods. Now we briefly looked at what a rule list might look like for cooking your grandmother's famous Sicilian roast chicken dish. But can you imagine if you wanted to build an app that could take photos of different food, how long your list of rules would be to differentiate 101 different foods? It'd be so long. You need rule sets for every single one. Let's just take one food, for example. How do you write a program to tell what a banana looks like? I mean you'd have to code what a banana looks like, but not only a banana, what everything that isn't a banana looks like. So keep this in mind. What deep learning is good for? Problems with long lists of rules, continually changing environments, or discovering insights within large collections of data.
Now, what deep learning is not good for? And I'm going to write typically here because, again, this is problem specific. Deep learning is quite powerful these days and things might change in the future. So keep an open mind, if there's anything about this course, it's not for me to tell you exactly what's what. It's for me to spark a curiosity into you to figure out what's what, or even better yet, what's not what. So when you need explainability, as we'll see, the patterns learned by a deep learning model, which is lots of numbers, called weights and biases, we'll have a look at that later on, are typically uninterpretable by a human. So some of the times deep learning models can have a million, 10 million, 100 million, a billion, some models are getting into the trillions of parameters. When I say parameters, I mean numbers or patterns in data. Remember, machine learning is turning things into numbers and then writing a machine learning model
to find patterns in those numbers. So sometimes those patterns themselves can be lists of numbers that are in the millions. And so can you imagine looking at a list of numbers that has a million different things going on? That's going to be quite hard. I find it hard to understand three or four numbers, let alone a million. And when the traditional approach is a better option, again, this is Google's rule number one of machine learning. If you can do what you need to do with a simple rule based system, well, maybe you don't need to use machine learning or deep learning. Again, I'm going to use the deep learning machine learning terms interchangeably. I'm not too concerned with definitions. You can form your own definitions, but just so you know, from my perspective, ML and deep learning are quite similar. When arrows are unacceptable. So since the outputs of a deep learning model aren't always predictable, we'll see that deep
learning models are probabilistic. That means they're when they predict something, they're making a probabilistic bet on it. Whereas in a rule based system, you kind of know what the outputs are going to be every single time. So if you can't have errors based on probabilistic errors, well, then you probably shouldn't use deep learning and you'd like to go back to a simple rule based system. And then finally, when you don't have much data, so deep learning models usually require a fairly large amount of data to produce great results. However, there's a caveat here, you know, at the start, I said typically, we're going to see some techniques of how to get great results without huge amounts of data. And again, I wrote typically here because there are techniques, you can just research deep learning explainability. You're going to find a whole bunch of stuff. You can look up examples of when machine learning versus deep learning. And then when arrows are
unacceptable, again, there are ways to make your model reproducible. So it predicts you know what's going to come out. So we do a lot of testing to verify this as well. And so what's next? Ah, we've got machine learning versus deep learning, and we're going to have a look at some different problem spaces in a second, and mainly breaking down in terms of what kind of data you have. Not going to do this now prevent this video from getting too long. We'll cover all these colorful beautiful pictures in the next video. Welcome back. So in the last video, we covered a few things of what deep learning is good for and what deep learning is typically not good for. So let's dive in to a little more of a comparison of machine learning versus deep learning. Again, I'm going to be using these terms quite interchangeably. But there are some specific things that typically you want traditional style of machine learning techniques versus deep learning. However,
this is constantly changing. So again, I'm not talking in absolutes here. I'm more just talking in general. And I'll leave it to you to use your own curiosity to research the specific differences between these two. But typically, for machine learning, like the traditional style of algorithms, although they are still machine learning algorithms, which is kind of a little bit confusing where deep learning and machine learning differ is you want to use traditional machine learning algorithms on structured data. So if you have tables of numbers, this is what I mean by structured rows and columns, structured data. And possibly one of the best algorithms for this type of data is a gradient boosted machine, such as xg boost. This is an algorithm that you'll see in a lot of data science competitions, and also used in production settings. When I say production settings, I mean, applications that you may interact with on the internet,
or use on a day to day. So that's production. xg boost is typically the favorite algorithm for these kinds of situations. So again, if you have structured data, you might look into xg boost rather than building a deep learning algorithm. But again, the rules aren't set in stone. That's where deep learning and machine learning is kind of an art kind of a science is that sometimes xg boost is the best for structured data, but there might be exceptions to the rule. But for deep learning, it is typically better for unstructured data. And what I mean by that is data that's kind of all over the place. It's not in your nice, standardized rows and columns. So say you had natural language such as this tweet by this person, whose name is quite similar to mine, and has the same Twitter account as me. Oh, maybe I wrote that. How do I learn machine learning? What you need to hear? Learn Python, learn math, start probability, software engineering, build.
What you need to do? Google it, go down the rabbit hole, resurfacing six to nine months, and ring assess. I like that. Or if you had a whole bunch of texts such as the definition for deep learning on Wikipedia, again, this is the reason why I'm not covering as many definitions in this course is because look how simple you can look these things up. Wikipedia is going to be able to define deep learning far better than what I can. I'm more focused on just getting involved in working hands on with this stuff than defining what it is. And then we have images. If we wanted to build a burger, take a photo app thing, you would work with image data, which doesn't really have much of a structure. Although we'll see that there are ways for deep learning that we can turn this kind of data to have some sort of structure through the beauty of a tensor. And then we might have audio files such as if you were talking to your voice assistant. I'm not going to say one because a whole bunch of my devices might go crazy if I say the name of
my voice assistant, which rhymes with I'm not even going to say that out loud. And so typically, for unstructured data, you'll want to use a neural network of some kind. So structured data, gradient boosted machine, or a random forest, or a tree based algorithm, such as extra boost, and unstructured data, neural networks. So let's keep going. Let's have a look at some of the common algorithms that you might use for structured data, machine learning versus unstructured data, deep learning. So random forest is one of my favorites, gradient boosted models, native base nearest neighbor, support vector machine, SVM, and then many more. But since the advent of deep learning, these are often referred to as shallow algorithms. So deep learning, why is it called deep learning? Well, as we'll see is that it can have many different layers of algorithm, you might have an input layer, 100 layers in the middle, and then an output layer.
But we'll get hands on with this later on. And so common algorithms for deep learning and neural networks, fully connected neural network, convolutional neural network, recurrent neural network, transformers have taken over over the past couple years, and of course, many more. And the beautiful thing about deep learning and neural networks is is almost as many problems that it can be applied to is as many different ways that you can construct them. So this is why I'm putting all these dot points on the page. And I can understand if you haven't had much experience of machine learning or deep learning, this can be a whole bunch of information overload. But good news is what we're going to be focused on building with PyTorch is neural networks, fully connected neural networks and convolutional neural networks, the foundation of deep learning. But the excellent thing is, the exciting thing is, is that if we learn these foundational building blocks,
we can get into these other styles of things here. And again, part art, part science of machine learning and deep learning is depending on how you represent your problem, depending on what your problem is, many of the algorithms here and here can be used for both. So I know I've just kind of bedazzled you and saying that, Oh, well, you kind of use these ones for deep learning, you kind of use these ones for machine learning. But depending on what your problem is, you can also use both. So that's a little bit of confusion to machine learning. But that's a fun part about it too, is use your curiosity to figure out what's best for whatever you're working on. And with all this talk about neural networks, how about in the next video, we cover what are neural networks. Now, I'd like you to Google this before we watch the next video, because it's going to be hundreds of definitions of what they are. And I'd like you to start forming your own definition of what a
neural network is. I'll see you in the next video. Welcome back. In the last video, I left you with the cliffhanger of a question. What are neural networks? And I gave you the challenge of Googling that, but you might have already done that by the time you've got here. Let's just do that together. If I type in what are neural networks, I've already done this. What are neural networks? Explain neural networks, neural network definition. There are hundreds of definitions of things like this online neural network in five minutes. Three blue one brown. I'd highly recommend that channel series on neural networks. That's going to be in the extracurricular stat quest is also amazing. So there's hundreds of different definitions on here, and you can read 10 of them, five of them, three of them, make your own definition. But for the sake of this course, here's how I'm going to find neural networks.
So we have some data of whatever it is. We might have images of food. We might have tweets or natural language, and we might have speech. So these are some examples of inputs for unstructured data, because they're not rows and columns. So these are the input data that we have. And then how do we use them with a neural network? Well, before data can be used in a neural network, it needs to be turned into numbers, because humans, we like looking at images of Raman and spaghetti. We know that that's Raman. We know that that's spaghetti after we've seen it one or two times. And we like reading good tweets, and we like listening to amazing music or hearing our friend talk on the phone in audio file. However, before a computer understands what's going on in these inputs, it needs to turn them into numbers. So this is what I call a numerical encoding or a representation. And this numerical encoding, these square brackets indicate that
it's part of a matrix or a tensor, which we're going to get very hands on with throughout this course. So we have our inputs, we've turned it into numbers, and then we pass it through a neural network. And now this is a graphic for a neural network. However, the graphics for neural networks, as we'll see, can get quite involved. But they all represent the same fundamentals. So if we go to this one, for example, we have an input layer, then we have multiple hidden layers. However, you define this, you can design these and how you want. Then we have an output layer. So our inputs will go in some kind of data. The hidden layers will perform mathematical operations on the input. So the numbers, and then we'll have an output. Oh, there's three blue one brown neural networks from the ground up. Great video. Highly recommend you check that out. But then if we come back to this, so we've got our inputs, we've turned it into numbers. And we've got our neural
networks that we put the input in. This is typically the input layer, hidden layer. This can be as many different layers as you want, as many different, each of these little dots is called a node. There's a lot of information here, but we're going to get hands-on with seeing what this looks like. And then we have some kind of output. Now, which neural network should you use? Well, you can choose the appropriate neural network for your problem, which could involve you hand coding each one of these steps. Or you could find one that has worked on problems similar to your own, such as for images, you might use a CNN, which is a convolutional neural network. For natural language, you might use a transformer. For speech, you might also use a transformer. But fundamentally, they all follow the same principle of inputs, manipulation, outputs. And so the neural network will learn a representation on its own. We want to find what it learns.
So it's going to manipulate these patterns in some way, shape, or form. And when I say learns representation, I'm going to also refer to it as learns patterns in the data. A lot of people refer to it as features. A feature may be the fact that the word do comes out to how, usually, in across a whole bunch of different languages. A feature can be almost anything you want. And again, we don't define this. The neural network learns these representations, patterns, features, also called weights on its own. And then where do we go from there? Well, we've got some sort of numbers, numerical encoding turned our data into numbers. Our neural network has learned a representation that it thinks best represents the patterns in our data. And then it outputs those representation outputs, which we can use. And often you'll hear this referred to as features or weight matrix or weight tensor.
Learned representation is also another common one. There's a lot of different terms for these things. And then it will output. We can convert these outputs into human understandable outputs. So if we were to look at these, this could be, again, I said representations or patterns that are neural network learns can be millions of numbers. This is only nine. So imagine if these were millions of different numbers, I can barely understand the nine numbers that is going on here. So we need a way to convert these into human understandable terms. So for this example, we might have some input data, which are images of food. And then we want our neural network to learn the representations between an image of ramen and an image of spaghetti. And then eventually we'll take those patterns that it's learned and we'll convert them into whether it thinks that this is an image of ramen or spaghetti. Or in the case of this tweet,
is this a tweet for a natural disaster or not a natural disaster? So our neural network has, well, we've written code to turn this into numbers. Pass it through our neural network. Our neural network has learned some kind of patterns. And then we ideally want it to represent this tweet as not a disaster. And then we can write code to do each of these steps here. And the same thing for these inputs going as speech, turning into something that you might say to your smart speaker, which I'm not going to say because a whole bunch of my devices might go off. And so let's cover the anatomy of neural networks. We've hinted at this a little bit already. But this is like neural network anatomy 101. Again, this is highly customizable what this thing actually is. We're going to see it in PyTorch code later on. But the data goes into the input layer. And in this case, the number of units slash neurons slash nodes is two hidden layers. You can have, I put a s here
because you can have one hidden layer, or the deep in deep learning comes from having lots of layers. So this is only showing four layers. You might have, well, this is three layers as well. It might be very deep neural networks such as ResNet 152. This is 152 different layers. So again, you can, or this is 34, because this is only ResNet 34. But ResNet 152 has 152 different layers. So that's a common computer vision or a popular computer vision algorithm, by the way.
Lots of terms we're throwing out here. But with time, you'll start to become familiar with them. So hidden layers can be almost as many as you want. We've only got pictured one here. And in this case, there's three hidden units slash neurons. And then we have an output layer. So the outputs learned representation or prediction probabilities from here, depending on how we set it up, which again, we will see what these are later on. And in this case, it has one hidden unit. So two input,
three, one output, you can customize the number of these, you can customize how many layers there are, you can customize what goes into here, you can customize what goes out of there. So now, if we talk about the overall architecture, which is describing all of the layers combined. So that's, when you hear neural network architecture, it talks about the input, the hidden layers, which may be more than one, and the output layer. So that's a terminology for overall architecture.
Now, I say patterns is an arbitrary term. You can hear embedding embedding might come from hidden layers, weights, feature representation, feature vectors, all referring to similar things. So, again, how do we turn our data into some numerical form, build a neural network to figure out patterns to output some desired output that we want. And now to get more technical, each layer is usually a combination of linear, so straight lines, and nonlinear, non-straight functions. So what I mean by that is a linear function is a straight line, a nonlinear function is a non-straight line. If I asked you to draw whatever you want with unlimited straight lines and not straight lines, so you can use straight lines or curved lines, what kind of patterns could you draw?
At a fundamental level, that is basically what a neural network is doing. It's using a combination of linear, straight lines, and not straight lines to draw patterns in our data. We'll see what this looks like later on. Now, from the next video, let's dive in briefly to different kinds of learning. So we've looked at what a neural network is, the overall algorithm, but there are also different paradigms of how a neural network learns. I'll see you in the next video. Welcome back. We've discussed a brief overview of an anatomy of what a neural network is, but let's now discuss some learning paradigms. So the first one is supervised learning, and then we have unsupervised and self-supervised learning, and transfer learning. Now supervised learning is when you have data and labels, such as in the example we gave at the start, which was how you would build a neural network or a machine learning algorithm to figure out the rules to
cook your Sicilian grandmother's famous roast chicken dish. So in the case of supervised learning, you'd have a lot of data, so inputs, such as raw ingredients as vegetables and chicken, and a lot of examples of what that inputs should ideally look like. Or in the case of discerning photos between a cat and a dog, you might have a thousand photos of a cat and a thousand photos of a dog that you know which photos are cat and which photos are dog, and you pass those photos to a machine learning algorithm to discern. So in that case, you have data, the photos, and the labels, aka cat and dog, for each of those photos. So that's supervised learning, data and labels. Unsupervised and self-supervised learning is you just have the data itself. You don't have any labels. So in the case of cat and dog photos, you only have the photos. You don't have the labels of cat and dog. So in the case of self-supervised learning,
you could get a machine learning algorithm to learn an inherent representation of what, and when I say representation, I mean patterns and numbers, I mean weights, I mean features, a whole bunch of different names describing the same thing. You could get a self-supervised learning algorithm to figure out the fundamental patterns between a dog and a cat image, but it wouldn't necessarily know the difference between the two. That's where you could come in later and go show me the patterns you've learned, and it might show you the patterns and you could go, okay, the patterns that look like this, a dog and the patterns that look like that, a cat. So self-supervised and unsupervised learning learn solely on the data itself. And then finally, transfer learning is a very, very important paradigm in deep learning. It's taking the patterns that one model has learned
of a data set and transferring it to another model, such in the case of if we were trying to build a supervised learning algorithm for discerning between cat and dog photos. We might start with a model that has already learned patterns and images and transfer those foundational patterns to our own model so that our model gets a head start. This is transfer learning is a very, very powerful technique, but as for this course, we're going to be writing code to focus on these two supervised learning and transfer learning, which are two of the most common paradigms or common types of learning in machine learning and deep learning. However, this style of code though can be adapted across different learning paradigms. Now, I just want to let you know there is one that I haven't mentioned here, which is kind of in its own bucket, and that is reinforcement learning. So I'll leave this
as an extension if you wanted to look it up. But essentially, this is a good one. That's a good photo, actually. So shout out to Katie Nuggets. The whole idea of reinforcement learning is that you have some kind of environment and an agent that does actions in that environment, and you give rewards and observations back to that agent. So say, for example, you wanted to teach your dog to urinate outside. Well, you would reward its actions of urinating outside and possibly not reward its actions of urinating all over your couch. So reinforcement learning is again, it's kind of in its own paradigm. This picture has a good explanation between unsupervised learning, supervised learning to separate two different things, and then reinforcement learning is kind of like that. But again, I will let you research the different learning paradigms a little bit more in your own time. As I said, we're going to be
focused on writing code to do supervised learning and transfer learning, specifically pytorch code. Now with that covered, let's get a few examples of what is deep learning actually used for. And before we get into the next video, I'm going to issue you a challenge to search this question yourself and come up with some of your own ideas for what deep learning is currently used for. So give that a shot and I'll see you in the next video. How'd you go? Did you do some research?
Did you find out what deep learning is actually used for? I bet you found a treasure trail of things. And hey, I mean, if you're reading this course, chances are that you probably already know some use cases for deep learning. You're like, Daniel, hurry up and get to the code. Well, we're going to get there, don't you worry? But let's have a look at some things that deep learning can be used for. But before, I just want to remind you of this comment. This is from Yasha Sway on the 2020 machine learning roadmap video. I think you can use ML and remember, ML is machine learning. And remember, deep learning is a part of ML for literally anything as long as you can convert it into numbers and program it to find patterns. Literally, it could be anything, any input or output from the universe. So that's a beautiful thing about machine learning is that if you can encode it something into numbers, chances are you can build a machine learning
algorithm to find patterns in those numbers. Will it work? Well, again, that's the reason machine learning and deep learning is part art, part science. A scientist would love to know that their experiments would work. But an artist is kind of excited about the fact that, I don't know, this might work, it might not. And so that's something to keep in mind. Along with the rule number one of machine learning is if you don't need it, you don't use it. But if you do use it, it can be used for almost anything. And let's get a little bit specific and find out some deep learning use cases. And I've put some up there for a reason because there are lots. These are just some that I interact with in my day to day life, such as recommendation, we've got a programming video, we've got a programming podcast, we got some jujitsu videos, we've got some RuneScape videos, a soundtrack from my favorite movie. Have you noticed, whenever you go to YouTube,
you don't really search for things anymore. Well, sometimes you might, but the recommendation page is pretty darn good. That's all powered by deep learning. And in the last 10 years, have you noticed that translation has got pretty good too? Well, that's powered by deep learning as well. Now, I don't have much hands on experience with this. I did use it when I was in Japan. I speak a very little amount of Japanese and even smaller amount of Mandarin. But if I wanted to translate deep learning as epic to Spanish, it might come out as el aprendise, profando es ebiko. Now, all of the native Spanish speakers watching this video can laugh at me because that was a very Australian version of saying deep learning is epic in Spanish. But that's so cool. All the Google Translate is now powered by deep learning. And the beautiful thing, if I couldn't say it myself, I could click this speaker and it would say it for me. So that speech recognition that's powered
by deep learning. So if you were to ask your voice assistant who's the biggest big dog of them all, of course, they're going to say you, which is what I've set up, my voice assistant to say. That's part of speech recognition. And in computer vision, oh, look at this. You see this? Where is this photo from? This photo is from this person driving this car. Did a hit and run on my car, at the front of my house, my apartment building, my car was parked on the street, this car, the trailer came off, ran into the back of my car, basically destroyed it, and then they drove off. However, my next door neighbors security camera picked up on this car. Now, I became a detective for a week, and I thought, hmm, if there was a computer vision algorithm built into that camera, it could have detected when the car hit. I mean, it took a lot of searching to find it, it turns out the car hit about 3.30am in the morning. So it's pitch black. And of course,

Ask anything
We've read this whole study set, so questions about it get the best answers.