 In this video, we will talk about Linear Regression in Priority to Handex. So, let us start with the activity. Assume that your students' performance, attendance and engagement data, you would like to predict the students' performance in the upcoming exam in your class. You have historical data, assume that your historical data from last 3 years or 4 years of day collected data from students. And you want to predict the students' performance in the upcoming exam. What data do we need? Like, do you need any other data? And how will you predict the performance? Given all this data, which data is important for you and how will you predict the system? So, it can be regression or anything else. So, think about it. Write down your answers after writing it down, resume the video to continue. Predicting performance requires identifying patterns from the historical data. And you can use attendance versus performance or engagement versus performance. You can do those kind of data picking. So, you can also talk about questions asked, difficulty level of each question, topic covered, you cover 4 topics, how much time you take into cover the topics. Questions we used, all these things can be also considered for the predicting. This also other data can be used. So, the step is you have to develop the model from the given data. So, that will be the linear regression model, we will talk about it. So, after developing the model from the training data, you have to extend the model to predict the future events that is apply the learn model new data that is with the current attendance what will happen. Suppose you created a linear regression model using learners attendance versus performance from the historical data. And that is a trained model and you are going to test it or you are going to use the model to predict the performance of the students attendance in the current semester. So, apply the learn to model to predict the future event that is a new data. That is the linear regression or any other predicting algorithm. So, what is regression? We talk about regression in this video. It is a statistical model which investigates the relationship between dependent and independent variable. We already saw regression briefly that it is to identify the linear relationship between dependent and independent variable. The assumption is there is a linear relationship. It is a very, very important assumption. And it is suitable for working with the continuous data. For example, the marks, we saw that instead of classifying into bin A, bin B, you want to predict in a continuous data like 75, 76.5 something like that. The use of regression is predicting or forecasting that is what will happen in the future predicting what will the students performance or evaluate the strength of predictors whether which particular independent variable is like strongly associated with the dependent variable something like that also can be evaluated using linear regression model. It is used widely just because it is easy and easy to understand, very no complexity at all to understand to create it. So, it is used widely as a first step in predictive models. So, we saw this picture already the regression can be classified into simple and multiple. Again, simple can be classified into linear regression or non-linear regression. Let us talk about simple linear regression. Then we will see one example of multiple linear regression. So, there are four types of regression other than the diagram shown in the previous picture. Let us take the linear only. Let us take the linear regression in that the simple regression means it has one independent value on one independent value. Let us see. What it means is the y is 1. There is no multiple things you are predicting x is 1. And we have what is that? We have weight or interscar like an intercept. So, c plus weight x1. So, weight 1 x1 y equal to mx plus c. So, the weight is this. So, there is a only one independent and one dependent variable here. So, that is called very simple regression, simple regression. In multiple regression, there is a one dependent value see y1 and intercept plus w1 x1 plus w2 x2. So, this can be like some n variable. So, the number of independent variable can be many. That is the idea. So, univariate regression and simple regression. So, univariate regression and simple regression this and this are same. There is no difference. It is again one independent single independent. But let us think about the multivariate regression. It is involves multiple dependent and multiple independent variables. It is not y1. You might have yi. Like you might predict yi, y1, y2, y3 also possible. So, we will not talk about that. That is not needed here. Let us think about simple regression and multiple regression. Let us solve first three things. So, in a simple regression, one variable is dependent that is predicted. Other variable is dependent. One is independent, one is dependent and you know that x and y. x is the independent and y is the dependent variable. Assume that there is a linear relationship between x and y. So, this assumption is very, very important. There is a linear relationship between x and y. If there is no linear relationship, simple regression cannot be used. So, given a dataset x and y or attendance and performance or engagement versus performance, linear regression model assumes that there is a relationship between x and y. That is linear relationship. And regression model analyzes the relationship between dependent and independent variable and tries to create a model from the historical data. So, the simple linear regression is simple y equal to mx plus ci, y equal to wx plus c. So, you know the slope is the w and c is the intercept. And we have six students data. Suppose, if you have six students data and which means you are six pairs of input data, six pairs of xi and y, x1, y1, x2, y2, something like that. Hope you understand what I am talking. So, you will have a one set of variable x1, y1. That can be say, attendance of 80 percent, final mark of 75, something like that. Similarly, x2, y2. So, if we have six students data, six pairs of x and y is available. That is the data. In a linear regression, the goal is to find a linear relationship between these two data that best fits this x and y. That is it. So, the very basic approach is let us talk about the attendance. We have six students attendance data and the marks out of the 100 for the same six students. So, we are plotting attendance in a percentage versus marks out of 100. Six students attendance here, six students marks here. Let us see how this line fits. So, you before doing this, you might see by descriptive analytics students to attend the class regularly scored good in exams. It is good. So, there is a descriptive analytics says that there is a linear relationship. So, by looking at this data in the plot, you might tell that there is a relationship. What is the relationship can be identified by diagnostic analytics? How to use that relationship to predict the future event is the predictor analytics. That is very simple example we are using it in the in this slide. So, let us see I plotted, I draw a line here. This line is like this. So, it fits almost all three data. And can we say this linear model is correct? If this model is correct, how do you validate it? Can you say this model is correct? And if it is correct, how do you validate it? Please pass this video and write down your answers after writing it down, resume the video to continue. So, the linear regression, now we see two models are there. I can say one fitting all this line, one line in the blue color it is actually bit low, but it might be better. Which model is correct? How do you know which model is correct? There might be multiple not just two, like there are a lot of things possible. So, there might be something like that, there might be something like this. So, the different lines are possible, which line is good or something similarly something not at all related to it. So, which line is good? How do you say this line is not good compared to other lines? How do you say this? This is the question. In order to do that it is very simple, we have to look at the objective function, you have to pick the line which gives the very least objective function that is we saw the objective function in our clustering example. Now we can see objective function is mean square error. Let us see how to compute the mean square error. The mean square error is identified by as a error means the error of predicted marks minus actual marks, the square of that. Let us see this example here. So, for attendance equal to 20%, the actual mark is 30. But the line, if you think about the line which is from the model, linear equation model gives you this particular line, which gives the value which is something related to some 35, some consider it is 35, it is not 35, but consider it is 35. So, the difference between this predicted versus actual does not matter which one is first because we are going to square it up, whether it is first or minus. So, the difference between this value 35 minus 30 is so, 5, 5 square is 25, even if it is minus 5 it will be 25. So, you have to use the least mean square method. So, least mean square method is basically compute this difference between actual and predicted in each point, sum it up and divided it by 6 values because the 6 samples you are finding the mean error, mean squared error. If you use the sum value also it is fine because both have a same relationship. So, compute that least compute that value for multiple lines. So, not just one line. So, you can have multiple lines, you can have one line here, one line there. So, compute that least mean square for multiple lines and pick the one which is best. So, consider a system started with the say a line like this and it found some error and it want to reduce or it want to go for the better model. How it go? So, the system will change the weight, based on the error system will change the weight. The training happens using different algorithms like gradient descent algorithm or some other algorithm. We do not want to talk about that in this course. The reason is it is not to understand how this model is created. If you are interested, go ahead and watch the videos by Andrew Ng and YouTube on Introduction to Mission Learning. He explains it very clearly how the weight is learned to train this linear regression model. That particular model gives this is the better score. So, say 0.799x plus 12.402. This 12.402 is actually intercept if you extend the line something like this it comes like that 12.402 that is where it cuts the 0. So, in this video we discuss what is linear regression and how to pick the best weight model. Thank you.