 So, yeah, first thing I have to admit, well, I mean, my excuse is like Dan has done it as well. The actual presentation has been built on React. Sorry. And what's your name? Jew. Yes. So, I wanted to just like talk a little bit about machine learning because I find it extremely interesting. And Jamie was really kind and he said yes, so here I am. So, my name is Jew. You can find me online on Twitter as Rcam with a four. And I work for a company here in London which is called AlphaSites. You should check it out. And we have a lot of my colleagues here. And also, Ed is leaving today, so please give it out for Ed. So, we're just going to play a game at first, which is I'm going to show you some steals from a couple of movies and you have to say the name of the movie. Are you guys ready? Close. Eventually. Eventually right. Come on. Come on. Good one. Good one. Yeah. Okay. Good. Good. Much better. So, if you think about, you know, like artificial intelligence in computer science, we're always talking about how computer science should, like artificial intelligence, should be how computers do stuff that humans do, right? Instead, if you think about what movies has taught us, usually computer intelligence is nothing like humans. Actually, computer intelligence is usually quite alien, usually has a certain disregard for the human life or lives. And it's just like something that humans don't really understand really well or at all. So, for me, it was always kind of weird that when we're talking about artificial intelligence, we're actually trying to make computers do exactly what human beings are doing. So, when I learned about machine learning, I thought, well, this just looks something more like the movies has taught me, right? So, it's something where the machine sort of learns about itself. You don't really understand what the machine is doing. At some point, the machine will tell you that the answer is something. And, yeah, you can't really discuss with the machine at that point. So, I thought it was cool just to show a little bit of slideshow initially of what actually you are using every day which has been built in machine learning. So, I think the most boring part of this thing is image processing because we have the technology which is called OCR, which I'm sure most of you are familiar with, which I'm sure most of your grandparents are familiar with. Mostly because this was invented at this point almost 30 years ago, right? And the idea is quite simple. There's like some numbers and some characters which are written by a human and the computer is able to recognize that. And we always take this completely for granted, but if I asked you as like part of your weekly iteration to build this in the next iteration, would you think you would be able to do that? Any takers? No? What's the challenge? You have two weeks to re-implement OCR. Two weeks to implement OCR, I will use R&D solutions. Very good, very good. So, I think there's a very nice comic from XKCD which is really about like this issue, right? You want to build an app which checks, which like a user can take a picture and you have to check if it's taking this picture in a natural park. It's super easy. You just like get the GPS information, you check if that coordinates are inside the park and you get it. But then as soon as you have to understand if the picture is representing a bird, you're like, yeah, I don't know, seems pretty hard. Usually it takes five years in a research team, right? Apparently someone in the world has these sort of research teams because when I upload pictures on the internet, there's like some weird algorithms which are able to recognize where are the faces of the people in the picture which I think is strikingly similar to how Terminator operates, right? Because if you want to resolve the human issue, you understand where the hat is and try to address that. I can do this in two weeks. That's great. There's a website with free movies and to download the movie you have to tell if there's a bird on the photo or not. Some SEO and it's very working. Yeah, sure. But let's say you can't use any existing library. You have to build it from scratch. Yeah, I know it's better. I would use human pages. I'm sure that this is how Facebook is doing it. They actually have like really a lot of human beings like selecting the faces of the people in the pictures. So this is all fun and all. But then there's this company which is called Google which has been developing these self-driving cars and this car has been already tested on the streets for almost like a billion miles, right? This car has been driving already for a billion miles and probably in 10 years if this technology actually works, it means like all the people right now are driving for a living. They won't have a job, which is, yeah. Okay, so let's switch to something more interesting, language processing. So as modern like citizens of the modern world, you're familiar with something which we call spam and luckily there's like some programs which are aptly named to destroy this spam and all these programs are actually like application of machine learning techniques. So like to detect if an email is spam is a typical machine learning task. You get the email, you have to understand if it's actually your grandma's engineering, the recipe of her cookies or it's like this Nigerian prince who wants to give you a fortune. I'm not talking about you're rich. Other than that, there's also stuff which is called sentiment analysis which is quite important if you're a politician, maybe a politician. Well, it's really important for politicians and basically the idea is that you get a lot of raw data like tweets or Facebook posts and you try to understand how people feel about Trump or Hillary just like from the text of the tweet. Something really interesting I've just read about this matter is that apparently Trump has two devices. He has an iPhone and has an Android phone and someone ran a text analysis on the tweets that Trump writes and has figured out that whenever he writes from the Android his tweets are more aggressive, they're more like inflammatory, they try to insult his opponent and for example whenever he's posting from this Android phone he never uses tags, right? Probably he doesn't understand and that's my theory. But whenever he's using his iPhone he's always using tags, he's always like complimenting like the US Olympic team and he's like being like very politically correct. So the theory in that article is that actually Trump actually has a Samsung Galaxy and we know that for a fact and probably his PR team has an iPhone or something like that. And actually if you read the article you can actually see like the split of the usage of terms so whenever he's like on his iPhone he's like bad, evil, problem and stuff like that. It's pretty interesting. So you should vote for him. Or like when you're using like Siri or like whichever program you try to tell the computer something and the computer has to understand it. To keep like the talk interesting we're going to talk about games, right? And usually games are fun and all but then there's this guy who is apparently one of the best players of Go in the whole world and he played against them a certain machine built actually here in London by DeepMind and he lost quite badly. I think 5-1? 4-1, yeah. And in the past 20 years Go has always been the go-to game. To basically showcase the fact that computers aren't as smart as human beings because in Go there are so many combinations as soon as two players start to put like four pebbles the number of combinations explodes so rapidly that we always use the game as a way to prove that computers are dumb, like we humans are smarter than that like we can do better in machines and apparently it's not true anymore and like all the machine learning experts were thinking well probably in the next 15-20 years we'll have like a natural program which will beat like a real champion and apparently the future is here because yeah it's quite scary. I think like a lot of like professional like Go players professional Go you know just like enthusiasts were really shocked by this and they expected a 9-dan champion to be beaten by a machine which is fair. So this is the same company who developed AlphaGo and it's called DeepMind Space here in London you should apply, hopefully it'll get you. I just want to show they built this little program which learns to play Atari games and basically at the beginning of the game he doesn't really understand what the breakout is I'm sure you guys are familiar with like what the breakout is there's a ball, there's like bricks like you don't have to let the ball, oh no my internet isn't working is it right? Oh okay awesome. So this is like 10 minutes in the training you see like the computer is pretty dumb like he doesn't really understand like what the goal is it's just like let's the ball fall down like come on whatever but and this is like 10 minutes inside the training he's just like trying to press some buttons and basically what the machine learning algorithm is doing is like trying to optimize the score and after 120 minutes of playing I think it plays pretty well and this is basically how I think like anyone starts like playing breakout like when you understand like what the goal of the game is and then at some point you lose because the ball is too fast or I don't know like you learn stand stuff right after another two hours of training the machine learning algorithm understands something is that if it's able to dig a tunnel in one side of the wall he doesn't have to do anything because the ball will like like clear stuff like by itself it's pretty like lazy algorithm right typical like computer scientist and they built this like general purpose program to play Atari games so when the game starts the algorithm doesn't even know what the game is like doesn't know like what the goal is you just know that he has to optimize a certain score and that's it which I find is really fascinating I can't see my... I should find again my cursor okay it's here we're back oops maybe let me try it yeah react there was oh okay cool we have another video here awesome so um there's this guy who built this neural network to play Mario actually some mario is like welcome back Zeppelin here you're watching a skilled player play Super Mario World but this player is not human it's a computer program I wrote called mario this program started out knowing absolutely nothing about Super Mario World or Super Nintendo's in fact it didn't even know that pressing right on the controller would make the player go towards the end of the level it learned all of these things through a process called neuro evolution in this video I want to teach you about how mario learned to beat this level donut planes won what his brain looks like and how it's all based on actual biological evolution let's start out by actually looking at mario's brain let's play it again but this time we'll look at mario's brain as a smith it's a simplified view of the level so basically like this is how the algorithm views the world there's mario somewhere there's like some obstacles and on the right you're able to see at some point that there are the possible keys which he can play while playing the game and what you see inside here this like mesh is actually the brain the neural network and basically depending on where mario is and where like how the environment looks like it decides which keys to press and initially it's really really like fun because you see like the the program like when it starts and it doesn't really understand stuff it's complicated but it's enough to make at least some progress at the level let's take a look at a sample of mario's how that works this is one of the randomly generated but eventually he'll get like smarter he'll build a huge neural network and he'll be able to play that game like we saw before which is pretty sweet the neural networks that appear where's my cursor why can't I get it back okay good one more video and yeah we can like show something more different actually this is an application of machine learning techniques to robotics so they wanted to they had this skeleton of different types of animals and the skeleton has muscular like a certain structure which like the muscle like were connected with right and they wanted to understand what sort of tension like you need to provide the muscles to keep the skeleton like walking right and they use machine a machine learning algorithm to train models in order to walk and they also gave them a certain targets like to like go to a certain speed and stuff like that and these are all the generations of the of the machine learning set up right you see like generation 1921 is just like he's got it and here like you can see like sort of like a giraffe is like oh my god look at this this is my favorite one look at generation 80 he's like he's almost got it or he's like really really lucky look at that he's like really there and rock and oh no no no no and then it's like yeah and then what is great is that as I said like you they optimize you for a certain target speed so for example for a human being they said like this certain speed and when you increase the speed see the guys like sort of running right which is you know expected but what happens if you try to apply this to other type of animals with like other like bone structure basically like you can see like this guy like sort of like is still able like to run but for an animal like this what we guys think like is the best way to run right like the model itself like understands and well if we can say understands in a certain way that this is the best way for this model to run you can watch the whole video it's like great at some point it goes on into like simulating like oh no it's not here like simulating an environment so it tries like to throw stuff at the thing and the thing has to like counterbalance and or like altering gravity so have you ever guys like seen like the pictures on the moon right and it's like frequently similar okay back let me just find okay cool now I got it so when the first time I saw this I was like wow this is like really impressive I want to do something like this and I really wonder to understand like how that's the whole thing work and so what I did is just like follow the Coursera course on machine learning which is really nice I really recommend like if you if you find this sort of stuff interesting I think you should definitely start with that one and basically the big like the core idea is that like there's like a definition which is like formal and then like the actual definition is that a computer program is going to perform a task when its performance can be measured by a metric which improves the big experience so basically you teach the machine how to do it how to do something you teach him how to understand like how well it's doing this certain thing and then you keep repeating this process so for example like when you're playing chess it could be like look at all the previous matches that were ever played by human beings and then you try to play against this program and see like how well it fares or this is like another classic machine learning sort of like recognized task which is to recognize Obama's face in pictures you just like provide this ton of pictures and the algorithm has to understand if there is Obama in it this is also good application for terminator I guess and for something more serious it could be like something as serious as tumor prediction so you take a historical data so pictures of tumors x-rays scans and you associate these scans with the fact if like the tumors malignant or benign and then you measure like how accurate you are and it's pretty insane to think about it so usually all these things work in a very similar way which is there is always a sort of training set so some certain way that we teach the algorithm like what is right then there is this feature like there is this process called feature selection where in all the data which is there in the training set you just select the features that you think are important and the last part is the test set so basically you just like take a little bit of your training set and you just like keep it on the side and you just use it to check if your model is accurate because the problem with the training set is that if you just use the whole training set you train an algorithm you could train possibly an algorithm which just matches 100% of the training set but that's not what we're trying to do we're trying to build a model which then we can apply to the real world so whether we use the test set for is just like to have a sort of reality check like are we doing something which is like real? will it actually work in the real world or not? so there is two like big types of machine learning algorithms supervised and unsupervised and usually on the ones on the left we are telling the machine ok this is the right answer and you have to learn how to tell if this is like what the answer is so for example spam detection is a supervised task because we have a lot of emails and we tell the machine ok this is spam this is not spam on the other hand we have something which is called unsupervised which means that honestly as humans we don't really know every time what the right answer is and to imagine it would be let's say you have a program which is called Google news and the goal of Google news is to scour the internet for every sort of news and article and then you want to have a front page of this product we hypothetically call Google news and we want to show all these articles which sort of belong to the same topic we want to group them together when you load Google news you'll see that it actually does this so for every big news there's links from newspapers all around the world and they have an algorithm which is doing this clustering operation is trying to understand what is this article talking about and grouping them all together which is pretty impressive so like the well-known techniques in supervised learning called linear regression we also see a couple of examples of this and logistical regression and neural networks for the unsupervised ones they're really useful for doing this sort of clustering for doing anomaly detection so you want to understand if there is something wrong at some point and for another operation which is called dimensionality reduction which means basically that in a lot of these machine learning tasks there's so many features you're considering to predict the price of a house and there's 25 different factors that could impact the price of this house but then you want to draw a table or a graph to represent it and our human brain is not able to process a graph built in 25 dimensions so usually they use these sort of techniques to try to reduce the dimensions to two or three and just to show these are the main factors of this model so linear regression is something which is pretty the idea is very simple so let's say I showed you a graph like this this is profit in ten thousands of dollars and populations of cities in ten thousands of people and I show you all these axes and I ask you then to predict what happens if someone is around 17 I would say probably someone is in this area and if you run the algorithm on it you'll do yeah that's like pretty much true but as I said before imagine if this problem was in 15 dimensions would you be able to point with your hand where the optimum is or where the prediction is like our human brains are incredibly skewed towards two three dimensions sometimes four if you're good but other than that you're just like you can't even imagine where it is and instead if you use a numerical approach it just works just as well with ten thousand dimensions so actually logistic regression is just about linear regression is about predicting a number and logistic regression is about predicting a Boolean so for example here we have these two sets it's like test about like microchip sizes and you see we have y equals zero y equals one and like here we can still figure out that probably the best way to describe that is that circle and the same the same reasoning applies here we could do this because it's in two dimensions if it was in ten thousand dimensions which is not something out of this world every sort of modern machine learning techniques deals with hundred thousands of features so you couldn't do that possibly um the last thing I want to talk about are called neural networks and if there's only one thing I hope you can remember after tonight it's just like this usually you always say neural networks are structured after our neurons and because our neurons have a nucleus they have these little dendrites where they use as inputs and then they emit one output through the accent so if you think about a neuron is this entity which has a lot of inputs and emits one single signal which usually is like either high or low so one or zero and don't be scared please so this is like really like the same thing just expressing like a more mathy situation right like you have a transfer function inputs and then you have some sort of like activating function I don't know what it is and then we have a single output the activation function actually is really important you don't really need to care about the maths like behind it but it's just the shape of the thing is interesting it's just like this sort of ass right and what we care about like this special function is that if we pass something which is greater usually than four it goes to one if we pass something minus four it goes to zero you just need to care about that right it's a function where you pass something which is like four more it goes to one something less than minus four it goes to zero so what if I told you that this is actually the implementation of OR gate using this neural network and we have this two inputs this is called the bias function so it's like something we always add is minus 10 and instead here are just like boolean values right so we have x1 and x2 and what we do there is just we multiply this value by this this value by this with some minus 10 and we plug it into the activation function so right so we can try it together right it's like zero zero it means zero zero minus 10 and as we remember minus 10 is less than minus four so it goes to zero if we try this it will be 20 minus 10 which is greater than four it goes to one same thing for this and here it goes like 40 minus 10 30 which is greater than four one so this is actually the neural network which implements an OR gate and as you can implement OR gate you can implement AND gates you can implement XOR gates and like basically when you can implement like the logic gates you can do everything in programming and in production basically you see neural networks which look more like this right I think the neural network one of the two neural networks which was used in alpha go has 16 layers and one thing to note notice that is the first layers called input layer and the layers which are in the middle are called hidden layers and in the hidden layers actually they store the actual brain of the algorithm like the actual these parameters which are stored in the hidden layers are actually what are controlling the intelligence of the neural network and in the end they just emit an output so ok cool I just wanted to show you this thing which comes back from 1991 is this guy which is called Yan Likun which is the grandfather of on-machine learning and now works at Facebook as their machine learning center oh really? oh no it's starting in 1991 or maybe I'm just mistaken is it working? and then he's like really happy about it so maybe we can cut there I mean I can't blame him I lost my mouse again how is it possible ok cool so how much time do we have? like 5 minutes? yeah so I just oh wow maybe well I won't show this video but you should watch it it's basically a clip from 2001 Space Odyssey and they trained a neural network on Picasso's paintings and they applied it on top of the movie as a filter so basically there's a whole clip of the movie which goes through like this movie through Picasso's eyes which I think is pretty sweet so I just wanted to do a quick demo because I thought it wasn't really fair to show all these like bright things without nothing like serious so just disable display and mirror displays cool awesome so this is my React server running can you guys see? right? ok a bit bigger good so for example like the thing I was showing you guys before about the supervised learning so like this is the the same example I showed you before and on the right there's like Octave which is this open source version of Matlab which is running and it just like prints out the result of the linear regression and it's just like this straight line which is not particularly interesting what I think is quite interesting instead is to see how actually this thing is calculated so the algorithm basically builds this sort of 3D representation of where the optimal points are and basically it starts at any point here and slowly goes down to the bottom of the valley and there is this mathematical formula and this mathematical process which sort of ensure you well it's not like you're not like 100% sure but they give you enough confidence that you've reached a certain minimum of that graph maybe it's not like the absolute like best minimum but it is a minimum and usually you can structure a problem so that you're pretty confident you've reached the end of it and as I said this thing which is run on these two dimensions it could be run on 100 dimensions and the mathematical formula works just as well it's just differential equations so yeah it is so and then this is like another way of representing this sort of problem with our eyes we can see the various slices of the cake it's sort of how we represent the rain and you can see here is the highest or well in this case the lowest part and how the algorithm operates it starts in any random point and tries to move around and see if it's going in the right direction and then as soon as you realize it's not moving anymore it tells us okay I probably have found like a local minimum okay which is good um octave and here like oh whoa so and this is like the other thing I showed you before so it's really similar so it just like runs the logistic regression on top of that yeah it tried okay good and it just like calculates this circle and all this is like MATLAB code which runs it's really fun so you should try it what I did on my own is to try to use an open source python framework which is called Theano but probably like you've heard about TensorFlow and Theano is something really similar there is another library which is called Keras which acts as an level of abstraction so you can both use Theano and TensorFlow and you don't have to change your code just change basically the adapter and what this does is it um does the digital recognition that we saw in the video so if I just do python mist I'll print out some stuff and this is like the test set data so there's 60,000 images they're all 28 by 28 pixels each one of the pixels is treated as an input in the neural network so basically this neural network has 700 I think it's written somewhere let's say 700 inputs and then there's this thing which is running which is trying to optimize the accuracy rate of the recognition and you see like after like 4 epochs it goes to 90 where is it 97.6 which I think like from the papers I've read it's really close to the human accuracy and I just like trained it for like 10 seconds and this is like how the best humans can do this task and like most like modern algorithms when like are trying to solve this problem they can achieve like 99.4 like accuracy on these tasks and the reason why the algorithms like make mistakes is because like the data isn't perfect right so for example like sometimes the algorithm makes a mistake because he thinks that this is a 2 and probably I could guess it's a 4 but it doesn't really look that much like a 4 to be honest and what is this like here like he predicts a 0 is actually a 6 so you can't really like blame the algorithm that much and instead when the algorithm works it looks like quite good so looks something like this this is in the prediction it's there somewhere so this like when the algorithm gets it's right and he recognizes this is a 5 which is pretty creative and if I had to show the code of this it's quite simple I think I have to close the Python graphs and it's just well I just keep like how the data is important and all that but basically this is like the heart of the whole thing it's creating a neural network where there's like 704 input inputs and then there's a hidden layer of 512 nodes there's another one like that and then like this is like the output layer since this is called a classification problem because we're trying to understand which one of the 10 digits it is so it needs like 10 outputs just like to try to understand that but as you see is pretty simple like the library makes like everything like really simple and then basically the way that you like run it you just say model fit you pass the training data you pass the output in the training you say like a couple of like options and like in this case I passed the validation data so that the algorithm is able to understand if it's like proceeding in the right direction or not okay cool so let me just go back I think I lost so yeah I just wanted to show this very last video which I think is it's really nice so like this guy programmed having some trouble with those menus so this game does not work well at all and that's not surprising playing Tetris well requires some thinking ahead and this algorithm does not think very far ahead there it was pausing a game for no reason and I think the reason it stacks up the blocks like that which is the worst possible tetris strategy is that it gets three points or so when it puts a block on top of another block so this is a really bad greedy planning and let's force fast forward a bit to see how this all ends it's not good so now it's almost done and pauses the game because as soon as he unpauses he will lose and really the only winning move is not to play thank you and so I just like ended with oh this is like something that will send me before so just like put it here oh no the robbers are killing us but why it was never programmed to do this and you'll notice that there's a little bug in the code so just be careful there never do this like you can do like the Yoda assignments so just put true on the left and like this will fail and you won't kill all the humans in the world so and yeah that's it sorry I was like a bit long