 My name is Jean-Clape and I'm a surgeon really on a mission to introduce healthcare professionals and Everyone interested really in solving health care problems to the world of deep neural networks Now if this is the first video that you see please go back and start the series from the beginning else This doesn't really make sense. There's a playlist on YouTube one video follows the rest So in case this is the first one that you see Please start at the beginning. It will really mean a lot more to you Of course, if you've been following along, let's continue our very exciting journey as we move towards Well, this is actually our last step. I would think before we really get into deep neural networks Now up till now. We've really only looked at a target variable that is of a numerical Continuous numerical type. So we're just trying to predict a single value In many cases though, we want to predict something that is a categorical variable Something such as the patient has a disease doesn't have a disease in the financial world We might say this is a fraudulent transaction or it's not a fraud fraudulent transaction We might have a CT scan with nodules in in the chest and it might you know We might have to classify that CT scan is that nodule on the CT scan is malignant or benign These are categorical outcomes the examples that I've mentioned have a sample space of only two So those are binary or dichotomous problems, but we can really model something with a thousand elements in the sample space of our target value Now this just introduces a slight Complexity to the problem, but believe me it is easily solved and you actually already know how to solve it So again, this is a document that's available on our pubs. You can download it I'll put it on GitHub as well. So you can look at these are files Again, if you just stumble across this, don't worry about the code As we start developing these as we as we move into real proper deep neural networks You'll pick up how to code in this environment called the our program language very very quickly I use the our programming language specifically because it is so easy to teach Which is what I do face-to-face as well statistical learning machine learning by statistics this using our in our studio and Although the main language for deep neural networks is Python Once you understand things in our it's very easy to pick up Python and continue your work there So no problem at all. Don't worry about the coding though You will definitely pick it up as we go So this is the document on our pubs You can read that if you don't want to Listen to this video and watch this video. You can just read the document So what we have here at the top you see a categorical target variable And we can to express this is zero one zero one and two depending on how many elements They are now and in the sample space of our target variable So if we have a binary outcome like yes or no We're just going to use zero and one and depending how you set up the problem You can decide which is going to be zero and which is going to be one Now an easy way to solve this problem is just what we call the sigmoid function that you can see here There we have it. It says take any input plug it in there So if I plug the value negative three in there, it'll be one over one plus e Which is Oilers number to the power minus negative three and that will give you a value Let me show you some code of what the sigmoid function actually looks like there we go No matter what input we give to the sigmoid function You see as I hover over here You see negative three point seven six negative three point six all the way up doesn't matter where I go Look at the values. They are always going to be between zero and one. They are constrained between zero and one and Following what we are trying to achieve Still trying to get these values for our parameters beta sub zero beta sub one that that really hasn't changed We still after that so this little z we can still see that as a problem that we set up Yeah, I've got a problem with four feature variables x one to x four And I still have my beta zero plus beta one beta two beta three beta four And I can just call that my z and plug that into this z here So in the end we have equation three here, which says sigmoid of Z is one over one plus e to the power negative That very familiar thing that we've watched in all the videos up till now that should be very familiar with you Very familiar for you. Now Here's the network that we also saw in a previous video I have values plugged in here for my feature variables x one x two x three x four I plug those values in I Multiply them by these parameters, which we call weights beta one beta two beta three beta four so that I get values in my hidden layer here, this is a hidden layer of nodes or neurons and They are just a multiplication of the weight and my input variable So for instance the values in row one of a spreadsheet and I add all of that together And I also add the bias node and now I get z and there is z just plugged in there And I plug it into the sigma function Right there and now it gives me y hat the predicted value Which remember if my output my target variable only has zero and ones in it zero and one zero one zero one zero one for all the rows I'm going to get a value here for my predicted which is going to be constrained between zero and one Sure, it's going to have some decimal values But it is constrained between zero and one exactly where I want it because now I have a target variable That is really within range of this zero and one Of my ground truth Target value. So let's look at an example. I'm going to import this logistic regression csv spreadsheet file And here we have it nicely expressed on the screen We see except one except two except three and except four Those are my four feature variables and you see the target variable. So for the first patient here, we have 15.5 110 2.5 52.6 you can imagine these are variables for some blood results or you know, whatever the case might be and the Outcome the target variable is a one and there's another one a one a one a one There's zero zero and you can go through click on all of these run through This whole data set of 150 entries Now fortunately for us in r, there is the glm function generalized linear models I can plug in all my values y being predicted by that dot means It's just a shorthand for x of one except two except three in except four It's uses a logistic regression model here with a binary outcome And if we look down here at the estimate column We see there are our beta values There's beta sub zero negative 13.8 beta sub one beta sub two beta sub three beta sub four So if I plug in this first patient's values 15.5 110 2.5 if I plug that in To my function one over one plus e to the power that I get a solution of 0.619 Now we can create a simple cutoff Remember this my y hat now my predicted Value for the target variable now the this patient was a 1.0 And what we can we simply do is say let's have a cutoff here. Let's go back to the graph Let's have a cutoff of right there And we say that everything above so You see it's 0.5 there on the y-axis Uh anything above that 0.5 we'll see as a one as it is going to one anyway and So 0.5 and up we'll see as a one and less than 0.5. We'll see as a zero And we can code for that and we'll do that in the when we create the neural networks So 0.619 that's above 0.05. So the prediction here will be for one Lo and behold that first patient did have a target value of one So the error made in this first step when we set up our loss function and our cost function As we did before so that we can do a back propagation to update these beta values In this instance, it's going to be spot on now This as we created it here is not a Neural network. We've just used plain simple old logistic regression. But as you can see It is absolutely correct. It predicted a one and it really is a one So there we have it I think that is the last piece of the puzzle that we require just before we move on to to proper neural networks Once again I plead with you to tell people about this video series about these publications on our pub I'll put some stuff out on linkedin as well. So Follow me on twitter Connect with me on on linkedin Look at these our pubs these files are available on github Subscribe on youtube if you really are interested in developing Your knowledge around deep neural networks so that you can learn to solve problems in your domain Let everyone know about these videos. Let's let's start a community where at least the From one point the viewed Medical professionals get involved and we don't just leave these two these problems to computer scientists We have the domain knowledge and it is really our duty to get involved with this Just send us an aside just the excuse of course all the noise. I've spoken to it about it before There's a nearest science center being built right outside my window here in my office And it's early in the morning even before Even before working hours. I come in early, but the noise is already going as they hammer away There nothing I can do about that I hope you enjoyed this video and in the next one. I hope that we get started on proper deep neural networks