Hello everyone, welcome to the video on S-Kellern Logistic Regression. In this video we are going to build a basic logistic regression using the Python S-Kellern package. For this for example, we are going to use the breast cancer data provided by UCI machine learning library. This particular data set is present in Kaggle. So we are going to use the Kaggle environment to basically use the data set and use the kernels to run this entire code on Python. I provided the link to this particular code in the description section. You can simply click on it and say copy and edit to basically get access and run the code yourself. When you say copy and edit, it's going to basically load you to this particular page and you can write your codes and execute your code on Kaggle or within Kaggle and get the outcomes here. Now let's begin with this particular example. We are going to do S-Kellern Logistic Regression and we are just going to do the basic version of it. First, we are going to begin by loading libraries. We are going to import pandas as PD and then from the S-Kellern we are going to take the linear model logistic regression. So we are going to import the logistic regression. This is the model that we will be building. To load the data set, first let me run this library code. So it's basically run and you will see that it's indicated as one, which means it's run successfully. Now I'm going to basically import this data set. To import this data set, I need to know where the data set is present within this structure. So if I run this particular piece of code, it tells me where the data set is present. So I can simply copy this location and paste it here, which will help me read the data set. Now if I run this code, I basically have the data set within data variable and if I can run this code, it will tell me what are the variables that I have. So I basically have ID, diagnosis and the different variables that are required for us to predict whether that particular breast has cancer or not. So let's move forward. Once I've done that, what I can do is I can separate the target variable that is the Y variable from the data set, the diagnosis column and the rest of the variable except ID, diagnosis and the unnamed 32. I'm going to basically drop those columns and take the rest of the variables as the X variables. So if I do that and run what's there within the X variables, these are the set of variables that will be present for us to predict whether our target variable is going to be benign or malignant. So let's go forward. Let's check if there are any missing values. Now if there are any missing values, you'll have to treat them. But in this case, we don't have any missing values, but just let's look at it. So we have around 569 rows and 30 columns. And if you look at whether there are some missing values or not, we can do X that is the X variables is null dot sum. It will tell us whether there are any missing values. If all of them are zero, which means we do not have any missing values. Okay, so now here we come to the most interesting part. We've basically done all of the checks that are required to be done to build to the modeling part. And here what we're going to do is we're going to initiate an instance of logistic regression into this variable log model. Now this will contain that instance and then take that instance and fit our X and target variable on top of it. That means you're going to build the model on here. So if I build the model, you'll see it gives me some error. Basically it says converging convergence warning, LBFGS fail to converge. Total number of iteration reached limit. This states that some of the defaults of the logistic regression are not sufficient to run this model. And by default, the solver is going to be LBFGS. And there are multiple other solvers that are available within the logistic regression. But by default, this is the one that we use. So what we're going to do is basically if the iteration reached a limit, I'm just going to take the max iterations to be around 5,000 so that there are enough iterations for this particular machine learning algorithm to solve it to converge and come to a conclusion. So if I run this again and build the model, this time it will not give me an error. It will just simply give me what final parameters were used to build this logistic regression. There are a lot of other parameters that are available, which we can tune. But since we are doing the basic model, we're just going to stick with the max iteration as the minimum input because we need the algorithm to converge and get as a good output. So once we have done that, what we can now do is check the accuracy of how good our model performed. So I can just say print of accuracy and say log model dot score and print the accuracy. So you'll see that we've got an accuracy of around 0.95, which means 95% of the predictions that we made are true. So this is how we basically build a basic model on logistic regression. The next video what we will do is try to look at the other parameters that are available within logistic regression and run the model and see if you can improve this score even further. I provided the link to this particular kernel in the description section below. If you like this particular code, please do not forget to hit the like button on this to basically help me to help you. Thank you for watching this video guys. If you like this video, please hit the thumbs up button.