How good does it feel?


The most important article on programming you’ll ever read

The hundred times that you fall over


when you're learning to ride a bike


is what makes that first ride so enjoyable,


that adventure.


So that's what I live for when I'm learning


or creating something,


is I don't want to speed up the process.


I want to magically stumble upon one of those moments


where one dot joins to the other


and it becomes this beautiful dance.


So I'm making this video,


it's going to be called Learn Slower


or something simple like that.


And I wanted to keep it simple


and to of course highlight the article,


Teach Yourself Programming in 10 Years,


is what's the rush?


If you are looking to do something worthwhile,


use your biology as a clock.


If something doesn't interest you,


if something's not fun,


well maybe you should either move to something else


or figure out a way to make it fun.


So you don't have to adhere.


The internet is such a beautiful place


is that you don't have to adhere


to the traditional style of learning anymore.


You can create your own path,


you can make it whatever you want.


Now of course, if you do make it whatever you want,


rest assured, if you have that freedom,


you now also have the responsibility


to take it upon yourself to follow that path


or create that path.


So in essence, learn slower, have fun with it.


Keep learning, keep creating, keep moving.


2020 Machine Learning Roadmap (95% valid for 2022)

If you can't tell, I'm so, so, so excited to be able to share this with you.


Now, I'm not going to hold you up for long.


I just wanted to take care of a few things before we get into the roadmap.


But the most important point is to make sure you have a play around with it yourself.


Check it out.


All the links that you need will be below.


There's the mind map itself or the roadmap itself.


There's the GitHub repo to go along with it, which has the full version image of it.


The most up-to-date link will be the map itself.


There's also the slides in the GitHub repo if you want to check them out.


And there's also timestamps.


So feel free to jump around.


You don't have to watch the whole thing.


Just jump around to points that suit you best.


And if there's anything else that's missing, if you have any questions, leave a comment


below and I'll get back to you.


And nonetheless, enjoy.


All right, all right, all right.


Welcome to Machine Learning Roadmap for 2020, aka a machine learning flavored visual interactive


living mind map slash compass.


Well, that was a bit of a mouthful, but let's not spend any more time talking about it.


Let's actually see this thing.


So if we come here, oh, this is interesting.


We've got some colors.


We've got some nice icons.


We've got a little white box with machine learning in it.


And so what we're going to do in this video is basically explore the field of machine


learning as much as we can in a relatively long, short-ish video.


I mean, whole textbooks have been written on machine learning, of course, but that's


not what we're here for.


We're going to go through some of the main topics of machine learning, such as machine


learning problems, the process, aka the steps in machine learning project, the resources,


like how you might want to learn machine learning, the places you want to visit, the tools you


can use to get the job done.


And after all, since machine learning is basically mathematics under the hood, we'll see what


some of the main topics are in terms of what kinds of math runs our machine learning algorithms.


But how we're going to do this, we're going to be playful.


And that's what I want you to do with this resource here.


By the way, all the links that I mentioned throughout this entire thing will be in the


description below, so you'll be able to access this as well.


Go through it, come to Whimsical.


This is the tool we use, by the way, Whimsical.


So if we click this little button here, whoa, it's going to expand out.


Look at that, far out.


We're going to jump through some of these, maybe not all of them, because again, don't


want this video getting too long.


If you do see a little purple button like this, you can see some more commentary, because


other than filling up this space, I've just added some comments there.


And if you want to leave your own comment, you can add one here.


So I've got mine here.


You can probably place your own as well.


Now let's get started.


What I've got to go along with this is a little presentation.


So what we're going to start with is a question probably smart to answer in doing a machine


learning roadmap video.


And that is, what is machine learning?


You might be asking as a curious internet dwelling user.


I just kind of said that.


And so for the sake of this video, I mean, you could Google machine learning, you could


get hundreds of different definitions.


But for the sake of this video, to keep it nice and simple, we're going to treat machine


learning as turning things, aka data, into numbers, and finding patterns in those numbers.


You might be wondering, well, how do you find those patterns in numbers?


Well the computer does this part.


Now, math.


And again, we'll cover a little bit on this later.


Now if you want another one liner definition of machine learning, machine learning is the


field of study that gives computers the ability to learn without being explicitly programmed.


Now that was by Arthur Samuel.


I think that was almost over 50 years ago now.


So that's a key point there, without being explicitly programmed.


So let's jump into traditional programming, which you might call software 1.0, versus


machine learning, software 2.0.


Now you might be wondering, what's the difference between the two?


What's the difference between traditional programming, the difference between machine


learning?


Well, before we even get into the difference, I just want to let you know is that machine


learning, to put it into practice, requires traditional programming to exist.


Whereas traditional programming does not require machine learning.


So although machine learning is amazing, remember, you will need some traditional programming


skills to be able to use it.


So if we come back here, you might be wondering, where did software 2.0 come from?


Well, that's when we can go to the roadmap.


Again, if I mentioned anything, it's probably in the roadmap.


So if I search software 2.0, there we go.


This is what I want you to do as well, is once we've had a little bit of exploring,


again, we'll go through this in a minute.


We're in the intro part just now.


So software 2.0, hmm, click on the link.


Oh, we got a blog post here.


I sometimes see people refer to neural networks as just another tool in your machine learning


toolbox.


Neural networks are not just another classifier.


They represent the beginning of a fundamental shift in how we write software.


They are software 2.0.


So I'll let you read that.


I'm not going to read through it all.


But this is the kind of way that you can explore this roadmap is that every little topic here,


if it requires more information, I've put a link there.


So be sure to check those out.


Let's go back to the presentation.


So let's have a visual demonstration of what traditional programming is compared with a


machine learning algorithm.


So in traditional programming, let's say you wanted to cook your favorite roast chicken


dish.


Look at that.


That's delicious.


It's not too much of a thing, but it's always a good time to talk about food.


So with traditional programming, you might start with a couple of inputs.


So say you've got your box of vegetables and the raw chicken.


You might program these steps.


You might go step one, cut the vegetables.


Step two, season the chicken.


Step three, get the oven preheated.


What temperature?


Who knows?


That's up to you.


That might be a passed down recipe from your Sicilian grandmother.


Cook the chicken for 30 minutes, add vegetables.


And then if you've done all this correctly, if you've started with the right ingredients,


you've started with the right rules that you've programmed yourself, you might end up with


this beautiful roast chicken.


Whereas a machine learning algorithm usually starts with a set of inputs and a set of ideal


outputs.


In this case, the ideal output is our Sicilian grandmother's roast chicken recipe.


And it might look at a hundred or a thousand different examples of these inputs and outputs.


And then it's going to figure out the instructions to what the recipe is.


So rather than us explicitly writing these instructions, this is the machine learning


algorithm figuring out patterns in data.


Actually before it could even figure out these patterns, it would have to figure out some


way to translate these inputs and outputs into numbers.


And how you do that is going to depend on what problem you're working on.


Right? The overarching process remains the same.


Turn your inputs into numbers and then let a machine learning algorithm figure out the


patterns in those numbers.


Now you might be wondering, okay, that sounds pretty cool.


So why would we use machine learning?


Now this is a quote from another curious and perhaps even more curious than before internet


dweller, which is also maybe yourself, if you're like me, pretty curious about things.


So the good reason would be why not, but let's cross that out for a second.


The better reason is can you think of all the rules?


Now what I mean by that, if we think back to our roast chicken example is of course


for that simple recipe, actually it might not be that simple depending on how complex


your Sicilian grandmother's roast chicken recipe is.


But for a more complex problem, do you think if you had to write out say a thousand different


rules, we'll have a good example of this coming up soon, but if you looked at something and


thought if I want to teach a car how to drive, do you think you could figure out all the


rules by yourself?


Well in my case, I know probably not, but if you had enough time, maybe you could.


So let's have a look.


What's the number one rule of machine learning?


If you can build a simple rule-based system that doesn't require machine learning, do


that.


And again, maybe this rule-based system is not very simple.


Maybe you've got a thousand different rules of how a car should approach a driving scenario.


If it backs out your driveway, maybe that's one rule.


Back out driveway, avoid a car.


Drive down the hill, that's another rule.


Turn right at the stop sign, that's another rule, et cetera, et cetera.


Don't hit people, that's probably the number one rule there.


And now this is a quote, again, from a wise software engineer.


Actually it's rule one of Google's machine learning handbook, which if we come back to


our roadmap, we'll zoom in.


Oh, this thing is a little bit fun to play around with.


If we go here, machine learning.


Actually if we just search Google machine, boom, Google's machine learning crash course.


Yes, excellent.


Actually, there's something in here that's supposed to be machine learning rules.


Machine learning 101, I should have given that something better.


Machine learning 101, I'm going to put in brackets here.


Machine learning rules, see?


This is a search problem by the way.


Machine learning 101, actually 43 rules.


So if we come here, we look at our link.


Rules of machine learning, now this is by Google.


Some big dogs in the machine learning field.


If there was probably one company that's using machine learning everywhere, it's Google.


So if we come down here, for some reason my scroll doesn't want to scroll.


There we go.


Before machine learning, rule number one, don't be afraid to launch a product without


machine learning.


As we talked about before, software 1.0, AKA hand coding everything, can exist without


Machine learning can't exist without software 1.0.


So what is machine learning good for?


And I just realized that that should probably be what is machine learning good for, rather


than this incorrect grammar.


Anyway, it doesn't matter.


So number one, machine learning is good for problems with long list of rules, just like


we discussed before with the self-driving car.


If you wanted to code up a self-driving car, you'd have to code in everything, such as


stop at stop signs, wait for pedestrians to cross the road, avoid hitting that beautiful


little dog that's just run out and chasing a ball.


So when the traditional approach fails, machine learning may help.


Number two, continually changing environments.


So again, with the self-driving car, the reason why I use self-driving cars, it's fairly easy


to imagine these kind of scenarios.


If you were driving along in your local suburb, you might know how to drive around pretty


well.


You could code those rules for your local suburb pretty spot on.


But then if you ventured out, say, into another city, a continually changing environment,


the rules that you made for your suburb of where you live may not work very well.


So in essence, machine learning is good for problems where it's required to adapt, aka


learn about new scenarios.


And finally, discovering insights within large collections of data.


Now can you imagine trying to go through every transaction of your, let's say, large company


has ever had by hand?


Like say you wanted to group together certain people, like what are people purchasing during


winter?


What are people purchasing during summer?


If you're Apple, what kind of people are purchasing iPhones?


And now, I mean, that's probably not a good example because Apple's pretty big on privacy


and they don't like collecting that sort of data, but maybe they will analyze it without


having your specific user ID in there.


So again, if you try to discover those insights within, let's say you had an imagine an Excel


spreadsheet with 10 million plus rows and you're trying to go through all of your customers'


purchases, how long do you think that would take?


That would probably take you a fairly long time.


But these things, the problems with long lists of rules, continually changing environments,


gathering insights within large collections of data, this is where machine learning really


flourishes.


If we want to see an example of this in practice, this is from Tesla's Autonomy Day video.


If we go here, this is actually a really cool video.


You can probably see why I was using the example of the self-driving car.


It shows you how Tesla uses machine learning in production.


So they're probably another one of the biggest companies that is actually using machine learning


extensively in their products.


So if you imagine Tesla have a data source, which is their cars and they collect data


from the environment.


These cars have a series of, I think it's eight cameras, they have a radar.


So all of these cars are collecting information from the environment.


Now if you imagine there's a camera on the front here and that camera is taking photos


of what the car can see essentially.


Now the job of a machine learning algorithm is to turn these photos here into numbers


to find patterns in those numbers.


Maybe it goes through these, it uses something like a convolutional neural network, which


might look like this.


It's a machine learning model drawn out.


It might go through each of these pixels, convert them into numbers and go, oh, okay,


I see this little number here.


That resembles a car.


That resembles something that I've seen before.


These numbers here along this straight line, okay, that looks like a road lane.


And I've seen these before.


And over here, that's a couple of headlights.


So we want to avoid that.


We want to not turn left into those headlights because that's another car and that would


be quite disastrous.


So if you were to try and code up all these rules yourself, that would take a very, very


long time.


So again, where does machine learning come into play?


Problems with long lists of rules.


So you might want to use computer vision to go through these and figure out where all


the different patterns are.


Now what happens here?


Okay, we might collect some data from the environment and find out that scenarios like


this are pretty inaccurate.


So we might do some testing and then we might go over here and find some more parts where


the car isn't doing very well.


The machine learning algorithm doesn't quite know these scenarios because this looks like


it's in a tunnel of some sort.


You might have treated your machine learning algorithm or your hard set of rules to work


for your suburb.


But as we said before, if it works in your suburb, it won't necessarily work in a tunnel.


So this is where machine learning comes into play again, in continually changing environments,


such as a road tunnel.


I mean, if I was to code up a self driving car, I don't drive through tunnels that often.


So I'd probably forget to put in tunnels.


And then when my self driving car approaches a tunnel, because it's got a whole bunch of


hand coded rules for driving around my streets, it would be like, I'm not sure what to do


with this.


So then you might grab these scenarios, you might label them.


That means you've got someone looking at this, maybe a human annotator, or maybe another


machine learning model.


Looking at these scenarios, it doesn't know very well and go, okay, I figured out these


scenarios.


This is actually a tunnel.


These are the tunnel walls.


These are quite hard to see.


But if you look closely, there's a truck here, there's lights at the top, maybe a car, a


self driving car gets confused with these lights at the top, they kind of look like


road lanes.


So we'd have to label it to tell our machine learning model.


Remember, machine learning model starts with inputs and outputs.


In our case, the outputs are the labels.


So just like our chicken example, the inputs may be the ingredients for your grandmother's


famous roast chicken dish.


In our case, the ingredients might be the images collected from a self driving car.


And the outputs may be the actions that self driving car should take.


Finally, once you've got those inputs and outputs together, you might train a machine


learning model, which usually looks something like this, and then deploy it back to the


car.


So eventually, this becomes a loop.


And so you see, this is the final thing that machine learning models are really great at


is discovering insights within large collections of data.


So you could imagine, if you're continually doing this loop, this little data engine here,


we'll dive back into this in another section of this video.


But if you imagine, this is going to start collecting lots and lots of data, lots and


lots of information.


And when I say data, that term is very broad.


Now, one kind of data could be photos and videos collected from the eight cameras on


a Tesla car.


Another one could be all of the transactions in your company's purchase history.


Another one could be all of the texts on Wikipedia, regardless of the data source, the principle


remains, how do we turn this information into numbers, let a model find some patterns in


it?


And then us design the software around it, this is usually software 1.0, to take the


outputs from the machine learning model and translate them into actions in a Tesla car.


And if you want to see this in more in depth, I encourage you to check out this Autonomy


Day video.


It's very, very good.


And so what we're going to cover pretty broadly, that was like a long winded bit of an intro


into machine learning in general.


I mean, again, you could look machine learning up and you could find out your own stuff.


But we've covered enough to understand what we're going to look through in this video.


So number one, we're going to look at machine learning problems, aka what does machine learning


problem look like?


How do you diagnose a machine learning problem?


Machine learning process.


So once you found a problem, what steps might you take to solve it?


Number three, machine learning tools.


Now, what tools should you use to build your solution?


This is growing quite rapidly, actually.


And now machine learning mathematics.


As we said, the computer finds patterns in our data.


And essentially what it's doing there is a whole bunch of math.


So what exactly is happening under the hood?


Now machine learning resources.


Okay, now, all of this is pretty cool.


You might be saying, how can I learn all of this?


Well, the good news is, is that a lot of it is available online and you can access it


right now.


And how are we going to go through all this?


Well, if we had a cook and a chemist style, if a chemist, if you imagine is really, really


specific going through all of these things, we're not going to go through it in chemist


style, we're going to go through it in cook style.


So if you imagine what a chef does, what a cook does, a chef uses their tools, such as


the controlled use of fire and a knife, and then it goes through and solves problems.


So that's how we're going to do this.


We're going to cover these topics broadly.


We're not going to dive too deep into each of them.


If I was to go through these and tell you exactly what each one of them is, that would


be doing you no justice.


Instead, what I will continually emphasise doing is actually on the next slide is how


to approach this roadmap.


The number one thing to do is explore.


Number two is to comment on this video or on the roadmap itself to give feedback.


What's missing from it?


Because of course, machine learning is a broad field that chances are I've definitely missed


something.


Give advice if you have any, share it if you want, follow your curiosity because there


is a lot.


So don't expect to get it all, in fact, I actually don't get it all.


I've put a lot of it here and I've kind of put it here for myself as well so I can come


back and research and upgrade my own knowledge.


And finally, we've got explore again.


And I put it there twice on purpose because that's what I want you to do is explore.


So in fact, you'll probably realise that this is not a roadmap essentially telling you where


to go.


It's more a compass, giving you a little nonlinear gentle push.


That's a little pun there from neural networks as well.


Okay, are you ready?


Okay, let's go.


Did you like that little sparkle effect?


I thought that was pretty cool.


So let's go.


We'll go back.


Boom.


Let's get our machine learning roadmap reset.


And we've got five major branches here that we're going to go through.


And we've got our little counterpart presentation.


Number one, machine learning problems.


As you can see, I've kind of created a little subsection in the presentation for each of


these little branches here.


Let's get into the first one.


So if we go this, what is wrong with this picture?


As you can see, this is actually a little bit of a famous metaphor here is putting the


cart before the horse.


This is probably the number one skill I can give you throughout this whole video is to


make sure when it comes to machine learning in general and machine learning problems,


it can be tempting to jump straight into machine learning and just go, boom, let's just put


machine learning in this thing and make it great.


I can tell you out of my own experience working as a machine learning engineer dealing with


a lot of customers and clients that wanted to know about machine learning and see if


it could be used.


This was their problem.


And including it actually is my problem as well, because I'm a machine learning engineer,


I look at everything with machine learning as my tool.


I want to use it for everything, but again, this is coming back to that software 1.0 versus


Machine learning is amazing.


We've seen some of the examples of where it can be used, but it does require a horse.


So what I mean by that is if you keep trying to apply machine learning to everything, it's


kind of like putting the horse before the cart.


So the idea of this section is to go from having the horse before the cart to having


it in the correct order.


Now we go to machine learning problems.


We've got categories of learning, supervised learning, unsupervised learning and transfer


learning, reinforcement learning.


There's probably some others here, but these are the four main ones you're probably likely


to encounter most often.


You can break them into your own subset.


Let's go finally jump in to the roadmap.


Oh, I'm so excited.


You ready?


Let's expand it.


Here we've got machine learning problems.


And what I've done is I've correlated, as I said before, the sections here to the sections


here.


So if we come in here, this is how I want you to use this roadmap.


We've got machine learning problems.


We break it out.


We come up here, categories, types of learning.


So supervised learning, what is that?


You have data and you have labels.


In our self-driving car example, our data might be images of tunnels, images of roads,


images of people crossing the road.


And the labels might be what those things actually are.


So it's one thing to have just the image.


It's another thing to go, okay, I know this is an image of a person crossing the road.


I know this is an image of a stop sign.


And so what the model does is it tries to learn the relationship between data and labels.


In our cooking example, it's trying to figure out the recipe.


So this is the machine learning model finding patterns in numbers.


For example, you have 10,000 photos of cats and dogs, 5,000 each.


In our case, this would be balance class problem.


Oftentimes in machine learning, actually, you'll have 9,990 photos of cats, but only


10 photos of dogs.


As you could imagine, a great example would be a self-driving car problem where you've


got a dog riding a bike.


Maybe you've got a million photos of a person riding a bike, but only one photo of a dog


riding a bike.


And who knows, maybe that's actually an alien.


So that's what you got to watch out for, but we'll cover that later.


And the labels for which photo contains which animal.


Photo one equals dog, photo two equals cat.


Works for numbers too.


For example, if you have 10,000 houses and their selling price, use the information about


the houses such as number of bathrooms, such as number of garages, such as number of bedrooms,


and try and predict the selling price of the house.


Wonderful.


I'm not going to read out all of these.


This is what I want it to be.


It's like kind of just a bouncing back and forth.


And truth be told, you could probably tell I haven't scripted this.


I'm kind of just working this out on the fly as well.


Unsupervised learning is data with no labels.


So the model tries to find patterns in the data without something to reference on.


For example, you might have 50,000 transactions and 49,997 of them are similar, but three


of them are completely outlandish.


This kind of problem is called anomaly detection.


Other common problems include clustering and dimensionality reduction.


And you've got reinforcement learning.


Actually, I could put a link for all of these, couldn't I?


Maybe I should do that.


Transfer learning is when you take the knowledge from one model and use it in your own.


For example, take all of the texts from Wikipedia, learn the relationships between words and


use these underlying relationships to help you build your insurance quote classifier.


Now transfer learning is a very valuable skill.


So we've got here transfer learning because oftentimes in practice, training a machine


learning model, so say you're building a self-driving car, for example, from that Tesla autonomy


day video that we talked about, that took 70,000 hours to train on a GPU cluster or


GPU hours.


Now you might not have access to that, but the beautiful thing about transfer learning


is that you can take what another machine learning model has, AKA the patterns a machine


learning model has learned on a particular data set, adjust it to your own, and then


use it for your own problem.


So if we come back to the PowerPoint, now we've got machine learning problems, some


problem domains.


Now some of the main ones we've kind of hinted on them just before are classification, regression,


clustering and dimensionality reduction.


Again, you could divert these into more things, but chances are if you figure out what, actually


there's, it could be sequence to sequence here, but I haven't covered that.


You could argue that sequence to sequence is actually a form of classification.


We'll get into that in a second.


We're kind of jumping ahead of ourselves here, Daniel, come on.


So classification would be like, does someone have heart disease or not based on their medical


records?


Regression would be predicting a number, trying to predict the sale price of a house.


If you were in the real estate business, you might be wondering, what should I list this


house price for?


You could build a machine learning model to go through all of the previous sales in your


area and figure out what the most ideal price is for your certain house based off the sale


price of all of the other houses.


So clustering, you might want to find out what different groups there are, as we said


before.


Say you had a whole series of transactions or a whole series of people listening to your


songs.


Say for example, you're Spotify and you have a million people listening to different songs.


What kind of songs are they listening to?


So maybe the people in this group are really into folk music.


The people in this group are really into rap music.


The people in this group are into pop music and the people here are really into rock.


Yeah, rock and roll.


Then finally, there's another one called dimensionality reduction, which is there's a little thing


in machine learning called the curse of dimensionality, which is when you have so much data that a


model can't really even find any patterns in it because there's just too much of it.


So what dimensionality reduction tries to do is reduce that amount of data you have


to only really pull out the most important thing.


So it might get rid of the weight column.


This is a table of numbers by the way, remember a machine learning algorithm finds patterns


in numbers.


So if we come back, we've got our classification problem.


We might start out by doing some dimensionality reduction because we're finding a machine


learning model can't really figure out if a person has heart disease or not.


It might go through, this is a simplified table of medical records and go, you know


what the only real two things that we need to know if someone has heart disease or not.


Again, this is just a made up example is their heart rate and their age.


If the heart rate's too high, they've probably got heart disease and so we actually don't


need their weight.


Again, this is a made up example just to simplify it and put it on one slide.


And so we come back to our roadmap.


We've got some example problems.


And before we even get to that, we've got classification.


So let's try clicking on this link.


Machine Learning Mastery, this is a great blog.


You should definitely check it out.


That's kind of what I've done actually.


In this roadmap, I've put all of my favorite resources for different things or just really


great resources for different topics.


So you should definitely, definitely, definitely check out the links.


If you want more information, I've kind of given a little blurb about a lot of things


that deserve a little blurb.


But if they need an expansion, this is where the links come in.


So classification, we got a binary classification.


Is this email that I'm receiving to my inbox, my email inbox, is this spam or not?


Again, imagine trying to code up all the rules for deciding whether an email is spam or not.


You would probably use machine learning for that.


Is this photo of a cat or a dog?


You could probably code in a cat's ear looks like a certain thing, a dog's face looks like


a certain thing, but I'm too lazy to do that.


That's one of the reasons I like to get into machine learning is that the computer figures


these things out for you.


Multiclass classification.


So that was binary, if something is one thing or not.


Multiclass is when you have multiple different options of what a specific thing is.


In the case of traffic lights, is it green, that would be class one or class zero if you


started from zero.


Yellow, that would be class one or red.


What breed of dog is in this photo?


So you might have 120 different dog breeds and you want to try and build a machine learning


model to classify what type of dog it is in a certain photo.


We actually did that.


I teach a machine learning course, by the way.


So this is a little bit of a plug for that, but obviously you don't have to do it.


I just want to show you an example of what a project in machine learning looks like.


We come here, load this up.


So we use transfer learning.


Remember what transfer learning is?


Come up here, taking the knowledge from one model and use it in your own.


That's what we did for this project.


So we turned some dog photos into numbers, AKA tensors.


We picked a model from TensorFlow Hub.


We'll see what that is in a moment in another section of this video.


We fit the model.


So that meant fitting is basically the same as, hey model, find the relationship between


these dog photos and the labels.


We evaluated it, see if it was good or not.


Then we improved it through experimentation and saved and reloaded a trained model.


So we come here, this is the kind of thing it looks like.


All this is machine learning code.


Now we come back.


There's also multi-label classification is what items does this photo contain?


What topics is this YouTube video about?


So if we were to build a multi-label classification machine learning model on this video that


you're watching right now, what would you like the machine learning model to output?


Is it a multi-label classification?


Could you put multiple topics?


Is this video about machine learning on its own or is it about machine learning problems


or is it about machine learning resources?


It could actually be about all of them.


So therefore it's multi-label.


Now if we come back to classification, remember classification is the type of machine learning


problem.


And then there's example problems.


And then we've got evaluation metrics.


In other words, how do we know how well our machine learning model has learned different


patterns for different problem sets?


So then we can evaluate it with a confusion matrix.


You might be wondering, what's a confusion matrix?


I'm a little bit confused about a confusion matrix.


Well if we have a look at this beautiful little link and this great guide from dataschool.io,


another amazing resource, this is a simple guide to confusion matrix terminology.


Okay, well if we read through this, okay this is a confusion matrix here.


So the number is 165, the number of total things, all right.


And so the actual no, actual yes predicted.


So a confusion matrix compares the actual labels from our machine learning problem to


the predicted, so what our machine learning model predicted.


So ideally in a confusion matrix, I won't go through it too much here, is that on the


diagonal you will have all the numbers to their maximum capabilities.


And on these sides here you'll have zero.


It predicted no when the actual was yes five times.


So you would say it's confused on these two sets of examples.


In other words it's a comparison between the true positives, true negatives, false positives


and false negatives.


But I digress, as I said we're just going to touch on these different things.


Rather than me go through each of them, it's much better for you to follow your own curiosity


and figure out what you should do.


So if you have a classification problem and you build a machine learning model, you should


be looking at these evaluation metrics to tell how well your model is doing.


So if we come down to regression, another type of machine learning problem.


Come back to our slide, remember regression is if we were trying to predict say a number,


say the ideal sale price for our house.


We come back, example problems given the number of bedrooms, number of bathrooms and house


location predict the sale price of a given house or how much will Bitcoin be worth tomorrow.


So if we look up Bitcoin price, now you see what we've got here?


All of this is actually information, this is data that machine learning model may be


able to find patterns in.


And now I'll give you a little bit of a warning for prediction, it's actually very hard.


There's actually a lot of companies that do dedicate a lot of time and money to figuring


out what the price of Bitcoin is or what the price of stocks are.


But this is just another example of where you can go, okay, you might look at this and


go PayPal deal won't drive Bitcoin price higher.


If you were to base your entire prediction of Bitcoin's price tomorrow by this headline,


what would you think?


So PayPal deal won't drive Bitcoin price higher.


You probably want to read the article for more.


But if I was to base it just off this one heading of the article, I would say Bitcoin


price will either not change or will in fact maybe go down a little bit based off this


headline.


And now again, I may be completely wrong, but this is the type of thing that a machine


learning model could do.


It could take in all of these headlines, it could even read the article, turn it into


numbers of some sort, and then look at the history of Bitcoin's price, something like


this and say, okay, well, on June 29th, it was 13,348 Australian dollars.


And these were the news headlines on that day.


And so if we come back, so if we go one week, on June 25, it was $13,552.


And the news headlines were saying that Bitcoin was going to go up, but actually went down.


So you might be able to figure out these patterns yourself.


But again, chances are, could you code all the rules yourself?


I know I probably couldn't.


So that's where you'd want to probably use machine learning.


We come back in to evaluate how your machine learning model is going there in a regression


problem, you usually want to use R squared or mean squared error, or mean absolute error.


So mean absolute error is all errors are on the same scale, eg, if trying to predict 100,


predicting 99 is the same error as predicting 101.


Whereas squared error, it makes the outliers stand out more.


That means if being 10% off is more than twice as bad as being 5% off, you probably want


to pay more attention to mean squared error.


Again, we've got some links here.


We're blistering through this, aren't we?


Now, another problem that we haven't mentioned here on the machine learning problems is sequence


to sequence.


So if we got here, sequence to sequence is taking a sequence of something and turning


it into a sequence of something else.


In other words, given a sequence of English text translated into French.


So if we go here, Google translate, this is a sequence to sequence problem.


Because we go here, I love machine learning so much.


We want to translate it to let's say Spanish.


Amor tanto el el prendizale automático.


Now if you can speak Spanish, you can probably correct my pronunciation or say whether this


is actually a correct translation.


But this is an example of a sequence to sequence problem using machine learning.


Again, if you went through the entire English language, you could figure out the rules of


what it translates into Spanish.


Or you could try to at least.


But in my case, I haven't got time to go through all the rules from English to Spanish.


So I'm more than happy for a machine learning model to look at, let's say all of English


Wikipedia and all of Spanish Wikipedia and see where they line up.


And then figure out the rules and use the patterns in those numbers.


So turn all of English into numbers, turn all of Spanish into numbers, let a machine


learning model figure out the patterns.


I'm more than happy to use those patterns.


Let's come back.


Finally, we've got clustering.


We talked about that a little bit before.


Then we've also got dimensionality reduction and some common techniques for doing dimensionality


reduction is PCA.


And there's also representation learning or feature learning.


And again, I've put some notes in here where I'm a little bit torn.


So for this one, representation learning may be better off on its own branch.


Better off, maybe better off, better off on its own branch.


Wonderful.


Okay, so we've gone through a bunch of different machine learning problems.


Remember, we're cooks not chemists at the moment.


So we've got, if we come back, supervised learning, unsupervised learning, reinforcement


learning, transfer learning, classification, regression, sequence to sequence, clustering,


dimensionality reduction.


There's some of our main machine learning problems.


Now, we come back, we've done one branch.


This is beautiful.


Let's come back to our little keynote here.


What are we up to next?


Machine learning process.


All right, let's dive in.


Now this is probably the biggest part of the entire roadmap.


And you can probably guess why because the process of doing machine learning is relatively,


I mean, let's just have a look.


We got here steps in a machine learning project.


Well, look at that.


If we zoom right out, here we go.


We've broken it all down.


Now I want to warn you again is that we're going through this as cooks not chemists.


So this might not be exact.


This is just what I've built out of my own experience.


What I found is most helpful.


It breaks down into a series of subtopics.


We've got data collection.


So if you want to find patterns in data, how do you collect that data in the first place?


And you've got data preparation.


Remember, as we said, machine learning model works on finding patterns in numbers.


So how do you turn that data that you collect into numbers?


Then we've got right down here, choosing an algorithm.


Or actually before that, we've got train model on data, which can be broken down into three


steps if you think about this.


Choose an algorithm or once you've had a little bit of experience, if you're a beginner, you're


probably never heard of these steps, but usually it goes choose a certain type of machine learning


algorithm.


Usually the algorithm is based off what machine learning problem you're facing.


So there's certain algorithms for certain problems.


Overfit the model.


Overfitting means the model has learned the pattern so well that it's doing too well.


And then reduce overfitting with regularization, which is a technique to hold our models potential


for learning patterns in data to hold it back so that it can adjust itself to new data.


And then if we come down here, well, analysis slash evaluation, serve model.


So once you've trained a machine learning model, it's one thing to train it on your


local computer.


It's another thing to have that deployed in production to say a million self-driving cars.


And then finally retrain the model when necessary.


So that's what we're going to go through.


And again, we're not going to cover all these because that'd take way too long, but we're


just going to bounce back and forth.


Let's go back to the presentation.


If we have a look at this, I've kind of made it into a little colorful flow chart too.


That's what we want to do is like a multi-angle attack.


Remember how I said I broke this down into like six different subtopics?


Well, that's all in one little beautiful colorful chart here.


We've got data collection.


We'll ask questions like what data exists?


Where can you get it?


Is the data public?


Are there privacy concerns?


Is it structured or unstructured?


What I mean by structured or unstructured is imagine structured is like an Excel spreadsheet.


You've got rows and columns.


Structured could be like a photo or a video or natural language text like this.


It has some kind of structure.


I mean, if it didn't have any structure, machine learning model wouldn't be able to find out


patterns in it, but it's not rows and columns type structure.


Data preparation.


Here you might do steps like exploratory data analysis or data pre-processing.


Remember turning data into numbers.


Data splitting, turning your data into a training, validation and test set.


We'll get into that in a moment.


Train a model, choose an algorithm, overfit then regularize, tune the hyper parameters.


Once you've trained a model, analyze the model.


Once you've analyzed the model and go, yes, my model is ready, you can serve it, AKA put


it into production so that people can actually use it.


Then finally, retrain a model.


If your data is continually changing, if you imagine a self-driving car problem where a


road has been updated due to roadworks, are your old predictions still valid on that new


road?


Again, here, it's a continuous process.


That's why we've got a big loop here.


It goes back and forth.


In traditional programming, you might just have your code and you have to make sure that


your code is up to date.


Whereas in machine learning, you've got code, you've got data, and you have to make sure


that they're both up to date.


Otherwise, you'll be predicting the wrong thing.


If we come back, let's go through our first little step here.


Data collection.


You've got some questions to ask here.


What data sources exist already?


Now, we're going to have an example of what data sources there are if we come down in


machine learning resources, but we're not up to that yet.


If you want to skip ahead, you can definitely skip ahead.


What privacy concerns are there?


If you're dealing with health data or medical data, it's probably a wise idea to make sure


that no personal information can be leaked.


Is the data public?


In the case of Tesla, we can't necessarily access all of their machine learning data.


Once you've formulated your machine learning problem, aka thought of whether it's a classification


task or regression task, one of your first steps is to start collecting data on that


problem to figure out if a machine learning model can find patterns in it.


What kind of problem are we trying to solve?


Well, actually, this should probably be number one.


There we go.


That can be in some relative order.


Where should you store the data?


Do you store it on your laptop or do you store it in the cloud?


And then you've got different types of data, as we said before, structured data, data which


appears in tabulated format, rows and column style, like what you'd find in an Excel spreadsheet.


Now, even within structured data, you have different types of data within that.


Nominal slash categorical data.


So is something one thing or another?


Are they mutually exclusive from each other?


For example, in car sales, colour is a category.


A car may be blue, but not white, and the order does not matter.


And you've got numerical.


Any continuous value where the difference between them matters.


For example, when selling houses, $107,850, that's actually probably a relatively cheap


house depending on where you're living in the world.


I mean, if that was Brisbane, I'd probably snap that house up in a heartbeat, unless


it's a bit of a dump, is more than $56,400.


Then you've got ordinal data, data with order.


Then you've got time series data, just like that Bitcoin example.


This is a time series data because it goes over a time period, one week, one month.


There we go.


So that's over a time period.


Come back.


Now you've got another type of data, which we touched on before, unstructured data.


So data with no rigid structure, images, video, natural language text, speech, what I'm saying


to you right now.


So if I wanted to build a speech to text system, how could it look at the sound waves that


are coming out of my mouth and figure out what that sound wave translates to in text?


Now I want to give you a little quiz as we're watching this.


If I wanted to do that problem, turn my voice, my sequence of words, there's a little hint


for you, sequence of words into text, what kind of problem would that be?


Well if we come back, all the way back down to our machine learning problems, this is


where exploring is so valuable.


That would be a sequence to sequence problem.


Build a device which responds to speech commands.


I'm not going to say that because my smart speaker is going to go off.


Speech goes in as a sequence of vibrations in the air, what I'm making now with my voice,


and it gets converted to text and interpreted as a command.


That's a sequence to sequence problem.


Same thing with playing the voice back.


It takes a sequence and then plays the voice back in a sequence of sound waves where I


just really confused myself there with my words, saying sequence so many times, but


you get what I mean.


You take one sequence of words, sound wave, generate that into text, and then for the


speaker to play something back, it will take the text, do some sort of command, and then


reply back with the voice.


So if we go here, close that one off, now we come back.


Now we've looked at data collection.


Let's have a concrete example, you know, because we don't just want to be jumping through all


these little tentacles here.


We come back to our Tesla data collection and model training little data engine here.


And now how might this fit in to this machine learning process?


We've got data collection, preparation, trainer model, analysis, evaluation, serve model,


retrain.


How might this fit in?


So if we put that back on the screen, wonderful.


So let's have a look at data collection.


We might have a data source.


Oh, and this is jumping ahead, but that is okay.


We have a data source.


So the cars, as I said, these all have cameras on them.


So they'll be collecting data from the environment, taking photos, etc, etc.


That's going to be stored in Tesla's server somewhere.


So this is their data collection.


They have a whole fleet of cars, actually a beautiful, probably one of the best examples


that you'll find in the real world is Tesla's data engine, this thing here.


So let's say data collection.


Now data preparation, we haven't touched on that yet.


So let's do that.


Whoa, we come here, we might close this one off.


So we know we've hit that up.


So this is data preparation.


So one of the first steps you might do in data preparation is a little thing called


exploratory data analysis, learning about the data you're working with.


And if we click this little link here, what do we come to?


Whoa, a general introduction to exploratory data analysis by yours truly.


So this is an 18 minute article on it.


If you wanted to find out a little bit more, it goes through an example problem.


But let's just talk about what we've got here on the roadmap.


So questions you might ask in an exploratory data analysis.


Basically what you're trying to do here is before your machine learning algorithm goes


through your data.


In the case of Tesla, before a machine learning algorithm even looks at this.


Now again, if you were building a self driving car, you might have some experience driving


a car so you kind of know what the data that it's collecting.


But you don't know how it's going to look when it's being collected from a camera here,


from a camera here, from a camera here.


And again, I'm making this up.


Maybe they have cameras in different positions.


Things you'll be asking.


What you're trying to do is just look at the information that you have and kind of build


your own machine learning model in your head before you even build one that uses math.


So what are the feature variables?


What are the inputs and what are the target variables?


The outputs in our case of cooking our favorite Sicilian grandmother roast chicken recipe,


the feature variables, the inputs might be the organic roast chicken or the organic chicken


from Ivy and Wood Farm up the road and the vegetables source from Blue Mountains and


all that sort of stuff.


Or really, you could just go buy it from the supermarket.


The target variable.


So the output might be that beautiful, delicious dish or in the Tesla car problem, it might


be not to drive head on into the wall.


For example, if you were predicting heart disease, the feature variables may be a person's


age, weight, average heart rate and their level of physical activity.


And the target variable will be whether or not they have heart disease.


And again, this has been very simplified.


But what kind of problem would that be if we were to take someone's health information


and try and figure out whether they had heart disease or not?


Is it classification?


Or is it regression?


Trying to predict a number?


If you guess classification, 10 points because that's one thing or another.


You might also ask, what kind of data do you have structured or unstructured, categorical


or numerical?


You might create a data dictionary for what each feature is.


For example, if you have a column of numbers called HR.


Now is that hours?


How would someone else know that it actually means heart rate?


So these are the things you might line up.


Let's go Kaggle.


Now Kaggle is another beautiful website for data sources.


And actually, you can learn a lot from Kaggle.


You can look at problems.


This is Titanic data.


This is what a data dictionary might look like.


There we go.


Variable.


So we've got these inputs here.


Survival, P class, someone's sex, their age.


Now what is SIBSP?


I don't know what SIBSP is.


But if we come to look, the definition is the number of siblings, spouses aboard the


Titanic.


Okay, now I'm starting to understand what kind of data I have.


So if we come back, are there missing values?


Should you remove them or fill them with feature imputation?


See below.


We'll look at that in a second.


Feature imputation is basically just a way of filling missing values.


What are the outliers?


How many of them are there?


They out by much.


Three plus standard deviations.


Now this is just a little heuristic.


You don't have to use that.


An outlier will really depend on the data that you're working with.


One way to find outliers is to plot a histogram, plot a distribution of your data if you're


not sure what that is.


We'll touch on that in a minute.


Why are the outliers there?


Are the questions you could ask a domain expert about the data.


For example, would a heart disease physician, remember our problem trying to predict heart


disease, would a heart disease physician be able to shed some light on your heart disease


data set?


More than likely, yes.


So we come back, data preparation.


We're still going.


That was only one step.


Exploratory data analysis, the main idea of that is to become one with your data, to build


your own machine learning model.


Now data pre-processing, preparing your data to be modelled.


Woo.


We got a few steps here.


Again, it's probably wise because we did cover EDA a bit.


Let's just jump to the major topics.


Feature imputation, filling missing values.


What's important to remember about a machine learning model is that for the time being,


if you're working with structured data, pretend that your machine learning model can't learn


on data that isn't there.


There is subtopics about machine learning models, adjusting to different data sources


and that sort of stuff, but we're not covering that.


We're covering the stuff that you're going to come across most often.


Machine learning model can't learn on data that isn't there.


So what you'll want to do is impute that data.


So fill it up.


So if you want to have a look at this article, great article here, six different ways to


compensate for missing values in a data set.


Then you might want to do feature encoding.


So once you filled your missing values in a data set, you typically do this with structured


data by the way.


Feature encoding is turning your data set into numbers.


Now machine learning model requires all values to be numerical.


No matter what you're trying to model, whether it's text, whether it's sound waves, whether


it's images, it has to be in some form of numerical form.


Then you've got one hot encoding and you've got label encoder, embedding encoding.


Now these are just different types of ways of turning your data into numbers.


Then you might have feature normalization or scaling or standardization.


So when your numerical variables are on different scales, for example, the number of bathrooms


is between, why don't we put is here, is between one and five and the size of land and size


of, oh, maybe we can, maybe put this so people know that it's a variable and size of land.


Again this is not scripted.


This is just us exploring this is between 5,000 and 20,000 square feet.


Some machine learning algorithms don't perform very well.


See how this is between one and five and other variable size of land is between 5,000 and


So the scaling is all off.


What normalization will do is put your variables between zero and one.


Scaling and standardization help to fix this.


And there's a little bit more in depth of what each of those are.


Feature engineering.


So this is where you input your own knowledge into your data.


So you might have a collection of data where you've just collected raw form from the environment.


And now feature engineering is where you take your domain knowledge and encode that into


the data.


So transform the data into potentially more meaningful representations by adding domain


knowledge.


If we click this little article here, boom, discover feature engineering, how to engineer


features and how to get good at it.


So I'll let you read through that one.


Oh, there's a good one there.


Feature engineering is an art.


So there is a lot of these topics and this is what what's quite hard about machine learning


actually is that a lot of these things that we're covering here aren't necessarily exact


sciences.


So, again, it's why I put it in the slides twice before that the biggest thing that I


can impart on you is a willingness to explore to try and figure out to try different experiments


and see what works and what doesn't.


In feature engineering, you got different things like decomposing, turning a date such


as imagine you've got this date here.


It looks like that 2020 06 18 at this time, you could decompose that into the hour of


the day, the day of the week, what day of week was that?


What day of month was that?


Is it a holiday?


So if you were looking at the Bitcoin price, and you're wondering, why is it so low there?


Okay, that's $12,963 on June 15.


Maybe June 15 was some special holiday or maybe something happened on that day that


you could encode into your data set based off this timestamp here.


Now of course, I'm making this up June 15 may have no significance whatsoever.


But these are the type of things that you can use your knowledge to enrich your data


set.


Then you've got di-cretization, I have to really think about how to pronounce that,


turning larger groups into smaller groups, got some examples there, crossing and interaction


features.


So combining two or more features, indicator features, so using other parts of the data


to indicate something potentially significant.


Now by the way, I've kind of put these in relative order that you'll take in a project.


But again, because it's so experimental, machine learning is a lot about just jumping between


different things.


So if you can't stress this enough, read through these things and just see if any of them relate


to what you're working on or just you want to learn more in general, hit the link.


Feature selection, so selecting the most valuable features of your data set to model.


Remember before when we removed those two features from trying to predict heart disease,


the curse of dimensionality, let's have a look at that actually, curse of dimensionality.


What is this thing I say?


The curse of dimensionality refers to the various phenomena that arise when analysing


and organising data in high dimensional spaces.


That do not occur.


So basically, high dimensional spaces just means lots of different data, like lots of


different features that do not occur in low dimensional settings, such as a three dimensional


physical space of everyday experience.


And that's another thing that you'll see with machine learning, because it's a lot of math


in there, which is, and don't get me wrong.


I'm not taking away the importance machine learning doesn't exist without math, put it


that way.


But you'll see a lot of things that can be quite daunting if you haven't covered math


in a while.


So you'll see Greek symbols, you'll see terms like high dimensionality space.


But the real best way to go about these things is just through practice.


Don't worry if you don't get it the first go, work through problems, work through projects


and read different things from different people, different sources.


With time, you will start to understand it more.


So with feature selection, you could do dimensionality reduction, feature importance, you typically


do that after modelling, wrapper methods such as genetic algorithms.


Whoa, that's a that's a big word there, Daniel.


Teapot does this.


I love teapot.


There we go.


Some cool code running there.


I'll let you check that out.


Dealing with imbalances.


Remember, we talked about this before we briefly touched on it.


Does your data have 10,000 examples of one class, but only 100 examples of another?


Now what's a good example for this?


Well, here's some ways that you can deal with that.


But a good example of this might be in the case of Twitter, if you have tweets, you might


have 10,000 of them that are good people being nice because generally people are pretty nice.


But you might have 100 examples of people just being toxic idiots.


When you're trying to build a Twitter classifier to go, well, this tweet is nice, or these


100 examples are actually pretty harmful.


Like these are people being really mean to someone else, and that's potentially harmful.


So you might not have many examples of these because hopefully, people are pretty good.


Now that's data pre-processing in a nutshell.


So if we come back, where were we in the presentation?


Data preparation.


Now in the case of Tesla, a preparation step might be trying to source different data sources


that you don't have very much of.


So let's say you've got a stop sign.


I've taken this from the Tesla autonomy day video, by the way.


There was an example in there, you've got some stop signs that are occluded by trees.


So imagine this is a stop sign.


If you're a Tesla car and you see that, what should you do?


So one of Tesla's data pre-processing steps would be to collect more images.


Now this is through analysis and evaluation.


Remember this is a continuous process.


Maybe they trained a model, found that their analysis on stop signs was not very good on


a certain number of scenarios, these scenarios.


So they might want to collect more data for that type of scenario, and then train their


model to be better on that scenario.


Remember, this is a continuous process.


So let's go back.


Finally, in data preparation, we've got data splitting.


Now this involves splitting your data into three sets.


The training set, which is usually 70 to 80% of the data.


So the model learns on this.


The validation set, typically 10 to 15% of the data.


The model hyperparameters are tuned on this.


Now if we imagine back to our cooking example at the start, hyperparameters are the settings


on your model that you can use to improve it, such as the settings on your oven when


you're cooking your grandma's famous Sicilian roast chicken dish.


If you cook it on 200 degrees, it might burn it.


But if you cook it on 180, you'll get that perfect dish.


And then finally, the test set, which is usually 10 to 15% of the data.


You want to keep this separate.


So this is like the training set is like if you were studying for an exam, the training


set is your course materials.


The validation set is your practice exam that your professor sets you.


And then the test set is the final exam.


So your model's final performance is evaluated on this.


And if you've done it right, hopefully the results on the test set give a good indication


of how the model should perform in the real world.


Do not use this data set to tune the model.


I can't stress that enough.


Keep these separate from each other.


Whoa.


So that's data preparation.


Let's go here.


Now we've got our data ready.


How do we train a model?


Remember the three steps.


Choose an algorithm, overfit the model.


So meaning that it's actually learned too well, it's learned the patterns too well.


Reduce the overfitting with regularization.


Again, if you're a beginner to machine learning, you'll look at something like regularization.


You'll be like, I've never heard of that word in my life.


Well, that's okay.


We're going to go through what it is.


Or another great trick is you just go, I'll show you how to use this.


This is a search bar.


We type in what is regularization.


Boom.


You'd be amazed at how far you'll get by just reading the top three links end to end.


Just read them.


Don't even bother.


Like if you don't understand some terms, just read them and then it'll sink into your brain


over the space of many months.


And then you can come back, read it again.


Oh, the second time you read it, it actually makes a little bit more sense.


Anyway, step one, choosing an algorithm.


How might we do this?


Well, I'll give you one great example.


Choosing the right estimator.


You might look at this and go, whoa, that chart has a lot of stuff on it.


But this is probably something you might get a little bit familiar with when you're starting


to learn machine learning.


This is scikit-learn.


Oh, let's take a little step back here at the moment.


You might be asking is, okay, Daniel, you're saying a whole bunch of stuff about machine


learning algorithms.


Do I have to know how to write all these?


Well, let me tell you how a machine learning engineer like myself or like many others do


work in practice.


They're even in the Tesla scenario.


This model here.


Chances are in Tesla's case, they're probably coding it from scratch.


But if you watch this video, they're actually using some form of transfer learning.


And it's not necessarily taking a model from another domain because their model is actually


very specific to their cars.


Someone has created a style of model.


In fact, it's called a ResNet model.


So if we go here, ResNet.


Typical naming, Resizural Neural Network.


So Tesla's models actually use ResNets under the hood.


But then they just apply.


So say, for example, you might have this part.


If someone's already built that, you can access that part right now.


But for Tesla's specific problem, they may build these parts with code.


So if you're starting out on your own problems, chances are the majority of this has been


built for you.


You just have to learn how to diagnose a certain problem, get your data ready to fit through


this model, and the outputs lined up.


That's a big part of machine learning right there.


So we'll come back to this, choosing the right estimator.


In Scikit-learn, which is a machine learning Python library, machine learning model is


often referred to as estimator.


So if we go through this, let's say for our heart disease classification problem, we have


start.


We only have, let's say, 300 patients.


So we have, yes, above 50 samples, predicting a category.


So we're doing classification.


So that's heart disease or not.


Do you have labeled data?


Yes.


We have under 100k samples.


So we might going to go a linear SVC.


Or you can actually try each of these.


The green boxes are machine learning algorithms.


If we go here, Ensembl classifier.


My favorite is the random forest, forest of randomized trees.


There we go.


Now if you've never coded before, you might look at this and go, whoa, what's going on


here?


But let me just talk you through this.


We've got from scikit-learn dot ensemble, so scikit-learn's ensemble models import random


forest classifier.


So this is a machine learning model here in code already written for us.


Then we're going to define our inputs, which is usually used as X, which is this series


of numbers here.


Then we're going to define our labels, which is usually defined as Y.


So this is inputs in the ideal outputs that we want.


Then we're going to instantiate our machine learning model, which is CLF is short for


classifier.


What we want to do here is our random forest classifier to work out the patterns between


This is associated with this number here because these brackets, this is one example and this


is one example here.


This is another example and this is another example here.


So clearly the pattern is here is if there's list of zeros, the output we want is zero.


And if there's list of ones, the output we want is one.


Very simple, but that's how the understanding starts.


It starts from the bottom and then we work it up to more complex scenarios like designing


a self-driving car.


So then we go here, we want n estimators.


So a random forest classifier is actually a combination of multiple different models.


So we want 10 different models in our CLF.


And then remember what I said before, fit is actually part of, hey, machine learning


model, find the patterns between this and this.


That's all we're doing.


That's machine learning code right there.


How cool is that?


So if you understand, we'll go through some learning pathways in a minute, but scikit-learn


chances are if you're using machine learning, you're probably going to come across scikit-learn.


It's actually a beautiful designed machine learning library.


That's just one little part of it.


We come back here.


So we choose an algorithm.


Now remember what I said, choosing an algorithm actually depends on what problem you're trying


to solve.


So we've got a series of supervised learning algorithms.


So that means you have data, you have labels, you've got linear regression.


I've got a link for each of these, logistic regression, k nearest neighbors, support vector


machines, decision trees and random forests.


We just saw one of those.


Now just knowing this doesn't necessarily mean that you know how the random forest classifier


works.


Do you need to know how the model works under the hood?


Now I would say to begin with, don't bother learning how each of these work under the


hood.


Instead practice applying each one of them in an experimentation fashion.


And then when your curiosity gets sparked on a certain type of one, because think about


this, that diagram we used before, it's trying to put the cart before the horse.


So see if these algorithms work or see if you can apply them in some way.


And then when you've got a little bit of momentum going and you want to figure out how do I


improve them or how do I understand this more so I know what's going on behind the scenes,


then start to dive deeper.


So there we go.


Neural networks.


Easy.


So as you see here, if you think that machine learning is just the neural networks that


you see or the artificial intelligence, also called deep learning, there's actually a lot


of different machine learning algorithm.


And with a little practice, you'll start to get better at assigning which one for certain


problems.


Again, it takes a lot of experimentation.


So neural networks can be used for a whole bunch of different things, classification,


regressions.


It makes a series of inputs, manipulates the inputs with linear, oh, fancy word, dot product


between weights and inputs and nonlinear functions, activation function.


What's that?


Well that's where you do some of your research.


You search out like this.


What is an activation function?


Activation function.


Boom.


You'd be surprised.


Again, Wikipedia, probably full of math.


Look at that.


But as I said, start by reading.


If you're curious about something, just read one post end to end and then start to dive


deeper when you need to.


So we've got other algorithms such as gradient boosting machines.


We've got links to those different types of neural networks, convolutional neural networks


typically used for computer vision, which is something like this.


Convolutional neural network is actually a max pooling layer there.


Now we're not diving too deep into what they are.


This is a high level overview.


Then you've got other algorithms for unsupervised algorithms.


Actually this is what we're missing.


We don't have any reinforcement learning algorithms.


In practice, I haven't come across using reinforcement learning algorithms outside of like a research


domain and what I mean by that.


The idea of research is sort of, of course, to push forward the knowledge of a space,


but it's not always necessary to put something in a practical use case such as in Tesla's


case, their whole game is machine learning on a scale that they can use in their self


driving cars.


But anyway, we have unsupervised algorithms such as clustering, visualization and dimensionality


reduction, anomaly detection.


So once you've chosen an algorithm, there we go.


There's a little bit of tidbit.


Every learning algorithm has a loss function and optimization criterion and optimization


routine.


Once you've chosen an algorithm, type of learning.


Now how does the algorithm actually learn on your data set?


We've got batch learning.


So in other words, all of your data exists in a big static warehouse and you train a


model on it.


Or you've got online learning.


Your data is constantly being updated and you constantly train new models on it.


Each learning step is usually fast and cheap opposed to batch learning, runs in production


and loans continuously.


So let's think about how Tesla might use batch learning or online learning.


Now for online learning, they may have a scenario where they need to quickly update a certain


thing in the car.


So they've retrained a smaller part of a model and deploy that to it.


And so what I mean by that is in our stop sign example, they might have found that,


say, our cars are performing really bad on stop signs like this.


So we need to upgrade our data set so that our machine learning model understands that


this is actually a stop sign and this is actually a stop sign and this is actually a stop sign.


So they might want to use online learning for that type of scenario.


Whereas batch learning is maybe they've got a new style of car in a prototype and it's


got instead of only eight cameras, it's got 25 cameras.


So they may take their entire data set of all the information from the eight camera


cars, combine it with their 25 camera cars and train a completely new machine learning


model in one big hit on all of the data that they have.


Now again, I'm making that example up, but that's just how you can imagine these things.


Batch learning, typically everything happens in one big go, online learning little by little


in a constantly changing environment.


Transfer learning, this is so important.


I want you to research this transfer learning, take the knowledge of one model, what it's


learned and use it with your own.


So transfer learning gives you the ability to leverage SOTA.


By the way, you're going to see the acronym SOTA a lot in machine learning research.


It's just means state of the art.


So the results your machine learning model are getting a state of the art on a certain


problem.


This is helpful if you don't have much data or vast compute resources.


So use the following resources for different transfer learning models, TensorFlow Hub,


PyTorch Hub, Hugging Face Transformers, Detectron 2 to name a few.


Active learning, so that's where you get a machine learning model to figure out some


things of its own.


And you also correct it with a human in the loop.


So for example, in the Tesla car scenario, our human in the loop may be finding the scenarios


where the car doesn't perform very well, collecting more data on that, and then putting it back


into the machine learning model, just like that stop sign we talked about.


Ensembling, not really a form of learning.


It's more combining different algorithms together.


A random forest is an example of an ensemble machine learning algorithm.


So that kind of means you're leveraging the wisdom of the crowd.


So if you ask one person, hey, what's the best direction to take left or right?


They might say right, but then if you ask nine other people, they might say left.


So should you trust the nine people or should you trust the one person?


Now if we come here, we've got underfitting.


So underfitting happens when your model doesn't perform as well as you'd like on your data.


So that means that basically the model hasn't learned as much as your evaluation metric


would like it to.


And remember if we come back up here, we go to our problems.


We've got a series of evaluation metrics.


Say we wanted to train a classification model to 99.99% accurate, but our model is actually


underfitting.


Where were we?


Underfitting.


And it's getting only 92% accuracy.


In the case of a Tesla car, you need almost 100% accuracy for detecting pedestrians because


if it fails to detect a pedestrian, well then that's not going to be very good for that


pedestrian is it?


So that's an example of underfitting.


Overfitting.


Happens when your validation loss, how your model is performing on the validation data


set, lower is better, starts to increase.


Hmm.


Or if you don't have a validation set, happens when the model performs far better on the


training set than on the test set.


Now overfitting is usually, say for example, when you're studying for an exam and you've


learned the course materials too much.


And then it comes time to the final exam and all you know is how to reproduce the course


materials.


So your skill set can't generalize, that's a machine learning term there as well, generalize


to a new set of problems.


So this in a machine learning sense, it typically happens when your evaluation metric is far


higher on the training set.


In other words, the course materials than on the test set.


So the test set is meant to mimic how your model might perform in a deployed scenario.


You can fix this through the various regularization techniques.


Here we go here.


We got L1, LASU and L2 ridge regularization, dropout.


So dropout is actually really convenient.


It basically says, hey, let's remove just random parts of our model so that the rest


of it becomes better.


Pretty cool, right?


Early stopping, so stop your model before the training of validation loss starts to


increase much more.


Data augmentation, batch normalization, again, these things, I'm going to be saying them


to you, but I'm kind of just tying them together with what we're doing here.


We're not, as I said before, we're not really diving into them.


If you're looking at this and going, holy crap, there is a lot here and there is, what's


important is that as you start to have practice in working with different machine learning


problems, you'll start to go, okay, I know where dropout fits in now.


I know where data augmentation fits in.


I know where batch normalization fits in.


All of this comes with practice.


What we're doing now is just tying things together.


And finally, once you've trained a model, you might do some hyperparameter tuning.


So run a bunch of experiments with different model settings and see which works best.


So you've got different components with your machine learning models.


Remember when I said we have the cooking experiment or the cooking example and to get the perfect


roast chicken dish, we might have to preheat the oven to 200.


That would be one setting.


We might also have to turn it on fan force.


So those would be two settings that we have to choose.


So with a machine learning model, you typically have parameters such as a learning rate, which


is often the most important hyperparameter.


There are different ways that you can set this setting, such as learning rate scheduling


or the cyclic learning rate.


There's also a different thing such as batch size, momentum, weight decay, number of layers.


Oh, we've already said batch size, number of trees, number of iterations, and many more.


A tip for tuning hyperparameters is if you're wanting to tune hyperparameters, try just


searching for the algorithm name such as random forest hyperparameter tuning.


So if we look at this paper, a disciplined approach to neural network hyperparameters.


Let's click this one.


So this is the kind of thing, the resources that you'll come across.


This is archive, by the way, where a lot of machine learning research gets published.


When you first interact with this, you're going to be like, whoa, a lot of complex stuff


going on here.


But again, with practice, you'll start to see the value in it.


You'll start to understand it more.


You'll start to see how you can use it in your own work.


This is taking a little while to load, isn't it?


A hyperparameter may be, so this is a machine learning model.


Let's say each of these is a model in itself, each of these little boxes.


These are often referred to as layers in a machine learning model.


Now if we wanted to improve this model, what we might do is add actually another three


of these boxes over here.


So then we've got a total of, well, there's one, two, three, four, five, six, seven, eight,


nine.


We add another three boxes over here to find more patterns in data.


And then we've got 12 boxes.


So now our machine learning model is actually comprised of 12 smaller models.


Remember ensemble learning.


Now that's using ensemble learning here is actually the wrong way to describe it.


But in terms of improving our model, one way might be to increase the number of layers


here.


So increase the complexity of the model.


Another way might be to decrease these.


So cut this off here and we only use six layers.


So that is a form of hyperparameter tuning.


Any setting that you change in a model by hand is a form of hyperparameter tuning.


So we come here, this is what a research paper looks like.


Pretty cool, hey?


So a disciplined approach to neural network hyperparameters.


So if you read through this, although deep learning has produced dazzling success for


applications of image, speech, and video processing, what's it say here?


Most training are with sub-optimal hyperparameters, see?


Requiring unnecessarily long training times.


So in the case of cooking our chicken, an unoptimized hyperparameter setting might be


an oven on 100 degrees.


So that's gonna take far too long for our chicken to cook.


So the ideal setting, a machine learning algorithm might have by default 100 degrees as its setting.


We might actually need 200.


So that's what hyperparameter tuning involves, is finding the right settings for your model.


Now I will give you a little tidbit as well.


Usually with machine learning model, hyperparameter tuning doesn't play as much as a part as data


collection and data preparation.


Those two alone will generally, if you have good data collection, if you have good data


prep, will result in a good machine learning model being trained.


Data slash evaluation, we've gone through a few of these evaluation metrics, but also


not only the metric performance, how long did training take?


How long does inference take?


And what are the costs involved with that?


For example, with the Tesla example, well I said example twice, but in Tesla's case,


in that autonomy day talk, this one here, they said that their model takes 70,000 GPU


hours to train.


Now let's just have a look at this, GPU pricing.


If we were to rent a GPU, now a GPU is a graphical processing unit, which is very fast at finding


patterns in numbers, which is what a machine learning model does.


If we were to rent a GPU, one GPU is, there we go, US dollars, a Tesla T4, which is kind


of an entry level GPU.


Why don't we use a V100?


That's actually a really fast GPU.


Let's say, there we go, P100, $1.46.


So if we did 1.46 times, if we want to rent that GPU for 70,000 hours, that's going to


cost us $102,200 to train one machine learning model.


Now of course, you're probably not training machine learning models yet as big as Tesla,


but these are things you're going to want to take into consideration, not just how well


the model performs.


If the model performs at 99.9% accuracy, but cost a million dollars to train, and you've


only got a budget of $2 million, well, you're not going to be able to train very many models.


An inference is how long does the model take to make a prediction?


So if our car is on the road and a machine learning model, it could be 99.9999999% accurate,


but it takes 10 seconds to make a prediction.


Do you think that's going to help?


The car's driving on the road and it sees a person coming up and it's like, oh, wait,


I'm just making a prediction.


I'm not sure what it is.


Give me 10 seconds, but I can assure you the prediction will be very accurate.


Probably not going to fly.


So that's where you have to take training and inference cost into account.


The what if tool.


So one of the big things about machine learning is that it's actually very hard to explain


what your machine learning model is doing.


The what if tool helps you with that.


Simply probe the behavior of trained machine learning models with minimal coding.


So I'll let you check out that.


That's a big thing about machine learning is explainability.


Least confident examples.


What does the model get wrong?


The bias and variance trade off.


So high bias results in underfitting.


Remember we talked about underfitting before and a lack of generalization to new samples.


High variance results in overfitting due to the model finding patterns in the data, which


is actually just random noise.


So machine learning models are actually really good at finding patterns in numbers, but sometimes


they're so good they can find patterns in what is just random noise in data.


So that's some analysis slash evaluation.


Now finally we got serve model and deploying a model.


After you've been through all of this, you've collected some data, you've prepared it, you've


trained a model, you've done some analysis and evaluation.


You want to get it into the world.


So if you were Tesla, you collected data, you prepped it, you trained your model, you


did some analysis, such as evaluation.


You've even got some new samples here that weren't very good and you've retrained a model.


Now you want to serve it.


So how do you get a model like in Tesla's case, how do you get it to cars?


But in your case, you might want to serve it through some sort of API or a web application


or an iPhone application.


Serving a model is referred to usually referred to as deploying a model.


So it's put the model into production and see how it goes.


Now you may have the best evaluation metrics in the world, okay, in a Jupiter notebook,


your model gets 99.9% accuracy on whatever problem it's working.


But when you put it into an application, everything starts to change because you're going to get


data sources.


People are going to use your model differently.


That's the real test of a machine learning model.


Now tools that you can use to do this, again, this space is rapidly evolving.


So chances are if you're watching this video in a few months, these might be outdated.


But right now, TensorFlow serving is going to be really good.


PyTorch serving, Google's AI platform, you can make your model available as a REST API.


SageMaker, which is Amazon Web Services, machine learning deployment tool.


And then you've got MLOps, which is kind of this thing, which is if you've heard of software


engineering DevOps, MLOps is DevOps for machine learning.


So it's basically all the technology required around a machine learning model.


So all of this stuff here is basically Tesla's data engine.


From collecting the data from the car, that would be one part of the operation to uploading


it to a data source, that would be another part of the operation.


And then modeling it, that would be another part of the operation.


This would be another part of the operation, testing it, collecting more data, etc, etc,


all in a loop.


How do you do that?


Well, there's a great blog post here by Chip Hewitt.


I'll let you read through that one, especially this part here, this link here.


Really good.


A guide to production level deep learning.


As you see, the modeling code is actually not as big a part as some of the other things


here.


So make sure you check that out.


And then finally, retraining a model.


Once your model is deployed, if you find that your model's predictions start to age, not


like a fine wine, or drift, that means that the data sources that your model is making


predictions on have usually changed.


So they might have new hardware, in the case of the Tesla car example, what if the camera


has got an upgrade and suddenly your machine learning model that was trained on lower resolution


photos doesn't work as well on higher resolution photos from the new cameras.


So that's when you'll want to train, retrain your model.


Far out.


That was a big dog one.


Machine learning process, steps in a machine learning project.


Collect some data, prepare the data, train a model on your data, analyze and evaluate


it, serve it, and then retrain a model.


If we come back, that's an example of how Tesla would do it.


Now I actually did this in one of my own projects about a month or so ago.


I collected some data from Open Images, which is a data source.


I preprocess it, actually, sorry, I used a Python script to download it.


I stored it in Google storage.


I prepared the data with a Python script.


I trained a model using Detectron 2 with transfer learning, by the way.


And to analyze and evaluate my model, I used weights and biases.


Now if you're looking at all these things and going, whoa, whoa, whoa, Daniel, we haven't


covered any tools yet.


Don't worry, we're going to get to tools.


I analyzed and tracked my experiments with weights and biases dashboard.


I made a user interface with Streamlit, which is a beautiful tool.


I wrapped all of this in a Docker container, pushed the Docker container to GCR, and deployed


my app with App Engine.


So this would be my machine learning ops, machine learning operations for replicating


Airbnb's amenity detection with Detectron 2.


Now retraining a model I didn't actually do, but if I was, I would find the worst performing


classes.


So this problem was using computer vision to detect amenities in photos.


Amenity detection.


This is what happened.


This is the problem in a nutshell.


You're Airbnb and you want to find out what amenities, AKA an oven or a kettle or a sink


or a bench or air conditioner are in your listings.


And so one way to do it is to use computer vision and analyze each of the photos as someone


uploads them to your platform, scan for different things in there, and then add it to your list


of amenities.


So if we come back to the presentation, that's what I did.


This was my process that I did.


If I wanted to retrain a model, I would find the worst performing classes.


So say my model sucked at finding chairs, I would get more photos of chairs, feed that


back into my Google storage for storing all the models, little typo there, and retrain


a model and then go back through this process.


If you want to see how this was done, there's a link there, debug.link slash Airbnb playlist.


Woo, I think we might be done with machine learning process.


As I said before, this is not an exhaustive list.


Although we did cover a whole bunch there, this video, I don't actually have long the


sections have been going for.


There's probably other stuff I've missed out.


So if there was, let me know.


But as I will keep saying until I go hoarse, go through this, explore it yourself, see


if you want to find out anything more.


Have a look at these cool little graphics and see how you can tie it in with the information


here.


So with that being said, what are we up to?


Boom, we are up to number three, machine learning tools.


Have a little chill out.


I'll be back in a second and we'll go through some machine learning tools that we can use


to get the job done.


All righty, where were we?


Machine learning tools.


Let's check it out.


We got here machine learning tools, tools you can use to get the job done.


Might have been a better idea to go in like a nice little circle and do mathematics or


whatever next, but we're already here.


Boom.


So broken this one into some libraries.


So these are Python flavored.


Might zoom in a little bit there.


Libraries Python flavored.


Now I say Python flavored, but you can actually write machine learning code in any programming


language that does or allows numerical computing.


A lot of these libraries here like scikit-learn, PyTorch, TensorFlow, and Python itself actually


execute C code under the hood.


So really fast code.


But when you're first getting started, chances are you're going to be interacting with one


of these libraries or one or more of these libraries.


I'd actually argue like if you're getting into deep learning, you probably should know


some PyTorch and TensorFlow.


I mean, they have a lot of overlaps, but we're getting too deep at the moment.


Let's get back to the little bit of a presentation.


And we have another very colorful diagram that has been broken out into some sections.


We've got libraries, code, slash code space, experiment tracking, pre-trained models, data


and model tracking, cloud compute services, hardware, in case you want to build your own


deep learning machine rather than using a cloud compute service, AutoML and hyperparameter


tuning, explainability, in case you wanted to get insights, why did my model do that


certain thing?


Machine learning lifecycle, aka ML Ops, that's probably a better name there.


User interface design at the moment, Streamlight is probably in a class of its own there.


It's pretty good.


Now, if we go through these, I'm not going to go through each one of these, but this


is probably the main stack you'll be using to write machine learning code right here.


Jupyter notebooks, TensorFlow.


If you want to do TensorFlow for the web, you'll use TensorFlow.js.


If you want to do TensorFlow on a mobile device or like a small computer, like a Raspberry


Pi, you'll probably use TensorFlow Lite.


PyTorch is very similar to TensorFlow.


PyTorch Lightning is like a wrapper of PyTorch.


ONNX is Open Neural Network Exchange, which basically converts your TensorFlow or PyTorch


model into another type of machine learning model that can be run across many different


types of hardware.


If you're thinking, well, I'm looking at all these and there's a lot here going on.


I mean, I told you, didn't I warn you at the start?


There is a lot to go through.


So don't worry if everything here seems overwhelming.


Rather than trying to learn all of these things in one hit, best to start working on your


own problems and figure out where do these pieces of the puzzle fit themselves in.


So if you're writing code in TensorFlow and you need to track your experiments, you might


use Dashboard by Weights and Biases.


And if you want to pre-train TensorFlow model, you might go to TensorFlow Hub.


And if you wanted to track the changes you're making to your data, you might use Weights


and Biases artifacts.


And if you want a cloud compute service, well, Google Colab is a free resource.


But if you need a bigger amount of compute, you might use Google Cloud or AWS or Microsoft


Azure.


And that is if you don't even have your own computing resources.


Now, truth be told, if you're first getting started, you're probably only going to be


using Colab to begin with.


But then it's very helpful, I will recommend this in the learning resource, to learn at


least one cloud provider.


If you're getting really serious, you might want to build your own deep learning computer,


which is basically just a normal computer with a really big dog GPU.


We're not going to dive too much into that.


I've got some links for those.


AutoML and hyperparameter tuning, if you want to improve the settings on your model, or


if you want to build an automatically generated machine learning model, there are tools for


that out there.


It's very rare these days, actually, unless you're a hardcore researcher, to build your


own machine learning model from scratch, you would more so use transfer learning, or AutoML.


If you just want to prove a concept, as a machine learning engineer, working as a machine


learning engineer, consulting to other businesses, we would often build small proofs of concept


using AutoML if they had any data, because it was just easier to do that, get it off


the ground, get something working, show them how it worked, and then build out custom features


when required.


Machine learning lifecycle, you have tools like Kubeflow, Selden, MLflow, truth be told,


like this is still being really worked out, like this is an evolving process, unless you're


a giant company who has their own custom machine learning lifecycle.


These are open source tools here.


I mean, I think Selden's now gone into a paid offering, but again, we're getting ahead of


ourselves here.