# Advance Machine Learning

- **Course:** 6103 - Advanced ML
- **Recorded:** 2026-09-01 18:30
- **Transcript:** 709 segments, 9324 words
- **Made by:** deepdml/faster-whisper-large-v3-turbo-ct2

---
Good evening, everybody. I hope my voice is clear to everybody. Okay, so thank you. We are starting our today class. So in the last class, we have seen many things, particularly I have covered what is training. Thank you. What is training? Before that we have seen what is supervised learning? What is unsupervised learning? What are the class? What are the labels? What are the target variables? Many things we have seen in the last class. I have covered what is training process. In the training process normally what we require our data set is required and normally we split the data set into the two part. Okay training data, training set we call and testing set. Okay and normally it is around 25 around 75% of the given data we keep for training purpose and remaining around 25% data we keep for the testing purpose. I think it was discussed in the last class. Am I correct? Yeah. Yeah, I agree with you. It is around 25% to 30%. Yeah. So we have a small topic just briefly I want to

cover, there are various, understand this topic, there are various ways to split the data, given data set. Out of those, today I am just introducing two methods, fold out method, fold out method and k cross validation, k cross validation, okay, value, yes, agree, okay, somebody is writing about the writing, okay, so notes are already will be given to you, so there is no issue of the writing because whatever I am covering, it is a complete separate notes will be given to you so don't give much focus on the way i'm writing because everything is in the form of word text document like in the last class everything it was covered like what is modeling what is training what is the setup of training and testing data set okay how to split the data set fold out method and k cross or k fold cross validation everything are here in clear notes it will be uploaded into the Moodle so you will get everything okay yeah you will get everything whatever I am writing here whatever it will be

available even I will try to improve it so the topic is here there are various ways there are not only the two ways there are various ways to split the given data set the most famous methods are the holdout method and the k fold cross validation. So, starting is with first what is what is what is holdout method. Recall the previous class discussion that was actually the holdout method. In the holdout method what happened the data set we split into two parts. we split data we split the data into two parts. So the major part that is around 70% we call it it is a training data set, training set and remaining 30% we call it test data set. okay so yesterday i have covered one method it was nothing but a simply a holdout method okay today i'm going to cover very briefly about k-fold k-fold cross validation it is very important because in the real life or in the real project we use k-fold cross validation it is a versatile

method okay so let me explain first if the data set is given to you like that please understand otherwise you will have a lot of confusion and lot of confusion yeah complete data set is given to you you need to decide the value of k what is k k means number of partition number of partition number of partition of data set of data set this should be equal size it should be equal size okay so suppose you want to partition the data into 5 equal power so the k will be 5 okay so today we will not discuss how to decide the value of k just understand the procedure understand the step of the method. K means number of part that you need to make of given data set. Agree? So, K means number of partition of equal size. So, what we do? So, suppose K is equal to 5. Assume that here K is equal to 5. So, I will partition the data K is equal to equal partition. Okay, like that. So, this is k is equal to one first part, k is equal to two, k is equal to third

part, four part and five part of equal size. Okay, now understand how the training process take place. Training process. It is very critical or very tricky. Understand. So, there will be k number of iteration. There will be k number of iterations. There will be k number of iterations. Okay. So, iteration 1. Understand. It is very tricky. Iteration 1. So, you will pick, you will pick one part, one part as a testing set. Okay. And all remaining, understand all remaining k minus 1, k minus 1 part combined, combined and use for training. What is the meaning of that? Meaning of that is that, meaning of this, suppose this is the data set, you have make, you have made five partition one two three four five iteration one any of the part you can consider any of the part you pick randomly or sequentially it does not make any difference keep that part for a testing purpose agree and remaining together combine it

it will become training purpose. Is it clear? So, iteration one, you train a model, whatever the algorithm you have, you need to train with this mature data set and one part you have blocked that you can use for the testing purpose. Is it clear? Now, iteration two, you have to repeat this process. You have to repeat this process again. Again you have a five partition. So suppose this partition earlier you have used as a testing purpose. Now you have to use any other unused partition for a testing purpose. So, suppose this time it is a testing set and remaining all, this and also this, okay, you need to combine and it will become a training data set, training set, okay. Same process we have to repeat for until all the partition has been used for a testing purpose. Idea is clear? Setup is clear or not? Great. Okay. So, what is the benefit of k-fold cross validation. What is the benefit of k fold cross validation? Just I want to see answer from your

side. I have discussed both the method. I have discussed versus holdout method. Holdout. How the k fold cross validation is better than the holdout method? Okay. Any idea? Yes. Correct answer. Each data set as touch all the data will be yeah yes yes yeah most of the answer are correct yes i'm very happy to see the answer so yeah yes so it a number of iteration i mean is depend on the k how you are deciding the k so it it is not right time to discuss how to decide the value of k it's depend on the size of the data set number of feature of the data set so the same data set you can develop the model by keeping the different value of the k. So you are correct. You can use different value of k with the same dataset. Yes, okay. Yes, so k bk is k is equal to number of iteration, number of partition, both are correct. Because both are correct. Whatever the number of partition you have, number of iteration automatically will be equal in that. So k is equal to number of

partition. If technically you want to ask, so answer is somebody will say k is equal to number of partition of equal size number of partition and number of partition automatically will be equal to the number of iteration. Automatically it will come. So now we are going to pick a new topic as I promised. I will cover fundamental of machine learning. So let me again make it like there is a two categories of the machine learning. Supervised learning. Supervised learning. Yeah, they are the disjoint. There should not be any overlapping. Sachin, there should not be any overlapping. You are correct. Is it clear? Sachin, there should be yeah no overlapping yeah totally separated data set five equal parts five equal parts without any overlapping classification and another is a regression agree so today i am covering here the first fundamental algorithm linear regression and their variant linear regression and their variant. I am going to cover it. Next class I will cover one of the basic

algorithm from the classification that is the logistic regression. Is it clear? So today we are here. Supervised learning, unsupervised learning, I cannot repeat otherwise the whole day will go and and we will not able to complete the course so just you just revisit the recording before starting of the next class okay how k fold is feasible in the large volume of data set okay okay so how if you are not going to use the k fold cross validation suppose it is a holdout method. So, how the holdout method is feasible? The same way K-fold cross-validation is feasible. Okay? It is more feasible, Muthu, because you are ultimate. One part you need to keep as a testing purpose and another combined part you need to as a training purpose. Okay, Muthu? So, Muthu is asking a very logical question. So, case 1. Understand the case 1. holdout method. Okay, holdout method. Okay, what you are doing? Suppose this is the data set.

Agree? Data set having one crore observations. According to Muthu, that is a very large data set. So what you are doing? You are keeping 25% data as a testing data and remaining all as a training data. Okay, training data. So this is 75 percent. Suppose it is 75 lakh. Okay and this is 25 lakh. Okay, case one. So according to if it is feasible then why case two is not feasible. One minute. So case two, case two is what same data set I have taken. same data set I have taken I have divided to I have divided data into the multiple parts suppose k is equal to 5 okay so suppose k is equal to 5 but k is equal to 4 suppose so here k is equal to 4 means again 25 percent data for the testing purpose 70 percent data for the training purpose us. Okay, so what is the problem here? Mutthu, what is the problem? Both are the same. Ultimate, we are not increasing the size of data at all in any case. The same data I am using both the cases,

either it is a k fold cross variation or it is fold out method. Only number of iterations are increasing. So it is better for us. We will have a better learning. We will have a better learning. Is it clear? Okay, Muthu, it is clear, I think so. Got it. Okay, so we are starting now in some pattern and then dividing K4. It's random. G1, it's a big question. You cannot decide. You cannot decide it is a random or in sequence. Okay, that is a very good question somebody has asked. So it depends. It depends. Okay. How? If the data set is sequential data, you need to understand what is sequential data. I hope during your UG course you have understood the sequential data and you have a data, another type, non-sequential data. Non-sequential data. Can you give me example of sequential data or non-sequential data? Sequential data means what? IoT data, NLP, text data, stock market data, weather data. All are the sequential data. Non-sequential data means images and any other things.

So, if the data is a sequential data, the split should be sequentially, split must be, not should be, must be sequentially. And if it is a non-sequential data, if you confirm in your application, then you can split randomly. You can split random. Okay. Is it correct? G1. It was great question. I have answered it. So, when we will start NLP, I will again cover that point. I will again cover that point. What is sequential data? What is not sequential data? I will cover it. Otherwise, you can just search and try to understand by yourself what are sequential data, what are not sequencing. Okay, great. So it's the right time to start linear regression. Linear regression algorithm. So I will upload this word file for you. Okay, so today we are going to see what is the linear model means. A variant of linear regressor, linear regressions are simple linear regression I will cover, multiple linear regression I will

cover, polynomial linear regression I will cover, training method very briefly. The gradient descent or gradient descent is a part of the course I will cover during the deep learning models. When we have a deep learning model, I will cover the gradient descent. So today I will not cover it. I will give you just a brief idea about what is the least square method of training the linear regression model. Hands-on will be on the implementing or coding classes. So linear regression is one of the most common and most studied machine learning algorithm in this field. We try to see how the linear regression algorithms look like, how we can represent all those things, what are the assumptions, and how to prepare your data set for the linear regression model and its training method. It's very, very, very interesting. I will cover everything. You don't worry about that. So starting with the simple definition of the linear regression.

So linear regression is a linear model. Model that assumes. So the question is that why it is linear model? Why we call it linear? It is called linear. Why? Because it assumes a linear relationship between the input variable x and the single output variable y. So, one by one I will cover it. In the data set, now you are in better position to understand. Suppose this is the data set. We have a lot of variable or feature like that and one target variable. What we try to do, we try to see how the features that is given to you in your dataset are connected to the target variable that we want so that by using this feature we can predict the target variable. Okay, so here target variable is always a single variable or feature. We can have a many feature. We have a many variable or many feature. If this is called, we call it input variable. I have covered it already in the previous class. We call it output variable. Okay, output variable.

Is it clear? So it is written here a linear regression is a linear model because it assumes the real linear relationship between input variables that may be many or maybe single with a single output variable. So more specifically if you try to say why is output variable that you you want to predict from the linear combination of the input variable linear combination of the input variable okay so there are three variants linear regression linear regression is the method there are the three variant first simple linear regression linear regression another was multiple linear regression and third one is a polynomial linear regression. So, understand here this is what simple linear regression? If number of input variable, number of input variable is equal to 1 and number of output variable is equal to 1, we call it simple linear regression. There is a one input variable and one output variable. This combination we call it simple linear representation.

Multiple linearization means number of input variable will be greater than equal to 2. Number of output variable always 1. What is simple linear regression? What is multiple linear regression? I hope it is clear to everybody. I will cover it later. What is polynomial linear regression? So same thing is written here. When there is a single input variable and by default we don't need to talk about there should be always a single output variable because there is always. So if there is a single input variable, we call it simple linear regression. If there are multiple input variables, we call it multiple linear regression. Just terminological introduction. Now, in some book you will find one variant of linear regression like least square linear regression. This variant is also in some of the literature. So what it is, it is a training method, it is a training method, it is a training method. So now understand one concept in machine learning, one ML algorithm is given, suppose it is

a linear regression and data set is given, data set is given. there are multiple ways of training. There are multiple ways of training. Same algorithm, either it is any kind of machine learning or deep learning algorithm, there are many ways to perform the training. So there is no fixed one way through which you should train the model. So here if this is the one way I call it least square method. Least square method, I will cover it today, least square method. If any of the linear regression follow the least square method for the training, we call it least square linear regression. We call it least square linear regression. this term is clear to everybody. There are many more. It is not right time to cover it because it is a fundamental of typical machine learning course. So, we have only introduction of the machine learning. That's why I'm covering what is necessary only. Is it clear to everybody? So, there is no relationship between holdout method

and k cross validation. This square method is a training method. So, don't mix the concept. holdout method and k fold cross relation are the way to split the dataset. Okay and least square method is a training method. Okay, is it clear? Don't get confused. Yeah, so if you are joining the lead, please observe what I am teaching. If in between, if you ask any question that I have already covered, it will kill our time. Okay, so everybody else is clear? fold out method or k fold cross validation are the splitting method okay and least square is a training method both are different thing great now come to here i think everybody you you recall your schooling you have seen this equation this equation is a line equation. I think everybody agree? This is the line equation. Okay? Yeah. So it is nothing but a simply a linear regression. It is nothing but a simply a linear regression equation. Linear regression equation. Okay. So here we write in different way like here we like b0 plus b1

x1 like this way. So this c we call it b0, this m we call it b1 or in many book also written like theta0 plus theta1 x1 like that. You can also write the equation of the linear regression here y is equal to w0 plus w1 x1. All are the same. In different different book people use a different different notation so these are equal to exactly mx plus c okay here c means what either people are using w0 theta 0 or b0 here m means people are replacing the with the symbol either b1 theta 1 w1. Okay. So geometric point of view somebody is writing on the chat box. Suppose this is the x-axis. This is the y-axis. Suppose this is the line. Okay. So this is called this intercept. What it is? This is intercept means C or V0 or theta 0 or W0. Agree? Agree? And an angle with axis with respect to x-axis, we call it what? We call it w1, theta1, m or p1 like though. Okay, so one is this is angle. This is the angle with x-axis. I think everybody comfortable.

This is the intercept. Intercept at y-axis. Agree? What is 3 variable? Where is the 3 variables? To spin, there is no 3 variable at all. Okay. Is it clear to everybody? Yeah. Somebody is confused with the 3 variable. I don't know why. I have explained everything. These are the symbols. Whatever the symbol you want, you can use. Okay. So, I want to extend. it is a two-dimensional, whatever the way I have discussed it, two-dimensional, two-dimensional view. We have only x-axis and we have only y-axis. If you have more dimension, then what happen? If you have more dimension, then, okay, what is this? What happen if you have more dimension? So the equation will be like that y is equal to if I use this way theta 0 theta 1 x 1 plus theta 2 x 2 like that like that you can add many dimension. Is it clear? Is it clear or not this equation? I am expanding the equation of the line in many dimensions. That's simple thing.

okay how to now the next question how to estimate the value of this coefficient this is called coefficient okay so you can call it coefficient or you can call it weight I think every you are more familiar with the term weight so you can write this equation w0 plus I will not repeat that part again like w2 x2 like w and xn so the question is that how to calculate tell me how to calculate it's very interesting everybody should be very much careful and and and and sincere and focus for today lecture how to calculate these value these value any idea yeah yes yeah thank you one more term people have used this is this is also called bias yes so intercept and bias both are same just just a terminological introduction intercept you can call in geometry in machine learning we call it the term bias both are same okay i have i have just mentioned in the notes okay look intercept and bias and coefficient now come back to our discussion how to calculate

these value any any idea how to estimate these value hit and try hit and trial put other dimension zero more answer i am looking yes use line equation already the line equation is given okay, your answer should be, your answer should be, it's not our heading, it's not our task, we should not, we should not estimate these values, it's not our task, okay, answer is that why the dataset is required then? Dataset will be there, training will be there, the training process. After the training, after the training, training process will give you all these values, all these values. This is not our task. It's a responsibility of the algorithm. It's a responsibility of the training method. So Rajiv and other who are trying to answer this question. All are wrong. If you are able to solve by yourself then why data set is required? Raju think and try to answer. Rajiv and Herz everybody have written. You are solving it mathematically

without machine learning process. You might have studied in the schooling but it is not typical math y is equal to mx plus c. We are using linear regression in machine learning. So the data set will be there yeah good question again so here y means output variable yes good question output variable or target variable and other x i so i can be from 1 to n these are the input variable these are the input variable or feature. Agree? Yeah. So, let me explain with one more example. Suppose you want to predict salary of particular CTC or package that may be offered during the placement drive and suppose this is the data set is given to you. First column is suppose first SAM CGPA okay this is second SAM CGPA like that this is your branch math whether you are from CSE, IT XYZ this is your internship detail internship detail okay this is your programming skill like that and this is your CTC. So, this data set is given already. Your objective is to train. I am writing a task.

Your objective is to get a model that will predict what? That will predict CTC of a student. Agree? This problem is clear. Objective is clear. So you have to write an equation. So y is equal to what? Ctc. This is b0 plus b1. What is x1? First same cgpa plus b2 from the data set. Second same cgpa plus b3. B3 is a branch. Okay. Then plus B4. B4 is what? Internship. Internship plus B5 programming skill. Yeah. This is the equation. This is the equation. Okay. How to map the given data set into the equation. I hope it is clear to everybody. So this is the right way to visualize the data set is given to you and how to write the equation. Okay, B0 will not map anybody. Okay, this is the bias, this is the intercept. Okay, you forget this, what is B1, X1? okay like so x1 is a one variable okay so we only associate coefficient with features we have extra coefficient we call it bias or intercept this is the where the line

cut on the y-axis so there is no variable we need to associate with this one it is a bias or intercept. No, no, no, at least no, you cannot say. Okay. Yeah. Yeah. Why is CTC? Whatever the target variable you want, it will be Y. Okay. So I will explain all these working with example. So what I'm going to do, I'm just taking example, example. Through that example, I will explain the training process. I will explain the training process based on the least square method, based on the least square method. Why the y is intercept is called the bias? There is no reason, just this is a termological introduction. So you can call anything else, it doesn't matter. So, there is no any scientific answer why we call it bias. So I will upload this file in the Moodle. So initially, it has given some sample of application that comes under the linear regression like from large list of donors predicting how much each one will donate. So it is a kind of

linear regression problem because output variable is what? How much money he or c is going to donate. So if your output variable is a continuous variable, the problem will become a linear regression. So you can refer it, there are some examples of applications that comes under the linear regression. Yeah, so look here I have taken one small data set. I will explain how the linear regression work on it. There are two variables are given in the data set. First one is the size of the house in square feet and second one is the price. So what we want to predict, I want to train a model in this data set so that your model will predict the price of the house based on the input variable size of the house. Is it clear? Very simplest data set I have taken having only single feature. That's why the linear regression in this case will become the simple linear regression. You try to recall what is the definition of the simple linear regression? There should be one

output variable and one input variable. So target is price. I want to predict the price based on what? based on the input variable size of the house. Yes, great, great. One input variable, one output variable. Yes, yes. Okay, so what will be the equation here? The equation will be the price of the house. Agree? Price of the house is equal to b0 plus b1 and size of the house. okay is it clear to everybody with this given data set this will be the equation of the linear regression great now yes yeah so yeah so you if you try to visualize if you try to one second yeah if you try to visualize how many observations are there in in this data set. Look, 1, 2, 3, 4, 5, 6, 7, 8. So if price of the house is y-axis and size of house is x-axis, you can visualize all data points. Look, x-axis here is the area or size of the house, y-axis is the price of the house and these white color points are nothing but simply a data, simply observations. Is it clear to everybody how to visualize

the two-dimensional data into the plot? So this is x-axis, this is y-axis, x-axis is the size, y-axis is the price and these are the data. Is it clear to everybody this diagram? question on this diagram please ask. Now this is the equation I have already written. Price will become the output variable then theta 0 plus theta 1 and the area and your objective is what? To calculate the value of theta 0 and theta 1 because they are these only the coefficient that is unknown. Price is known to me, it comes from the data set, area comes from the data set, which coefficients value that is unknown, these are the coefficients, theta 0 and theta 1. So our objective is what? Our objective is through the training with With data set, we will estimate these, agree or if you don't want to mention here B0 or B1. Is it clear? Is it clear up to this moment? So if I ask what is the output of training, can you answer it?

is the output of training. Output of the training is value of coefficient on me or if I say right value or okay understand right value of the coefficient. So that is the purpose of the training. Got it? Yes. Yes. Now come back to the notes here. Yeah. So this is a one picture where all the observations are displayed on the 2D space. Great. Yeah. This is very important. So, come here, yes, it's most tricky and important part, please. Suppose these are the datasets, okay, these are the data, agree, everybody agree, suppose these are data, I want to draw a line, I want to draw a line, what is this, this is your linear regression model, I want to draw a line. So that by giving the value of x, my line will predict the value of y. How to do it? Just focus on my discussion. If I request, do not ask the question in between. Just see what I am doing. So if you are able to see here it in light color, one line is

drawn over here i want to draw a line okay how to draw a line that is the second question okay so the question is here how to draw a line first tell me training is starting i am i'm going to explain the training i'm i'm explaining the training process i'm explaining the training process training process of linear regression using a least square method using the least square method i'm explaining that part okay so the first part first step of the training is what? Draw a random line. Draw a random line. Okay, draw a random line. Line, when I say the random line means it is a linear regression model. It is a linear regression model. Okay, so draw a random line. So now question is that how to draw a random line? Anyone can answer it. How to draw a random line? From scratch I'm explaining you will not find any video or any other way where people are explaining in that level. So the first step is that in the linear regression draw a random line. How to draw

a random line? I'm just waiting for your answer and suppose in this case equation is the price is equal to b0 plus b1 size no nobody is answering no i didn't get any correct answer if i ask this question in interview you will get zero marks zero marks again no no yes tusar has written correct answer everybody please see the answer given by the tusar yeah, you assume value of v0, v1, any random value, any random value. Or you can initialize with them with the 0, 0. So this is, for example, these are the weight w1, wmin. In machine learning, we call the concept of the weight initialization. We call it the the weight initialization. Weight initialization means whatever the coefficient you are using, you initialize with the 0 or 0.1 with the small value or any other random value. Whatever way you want you can. Is it clear? For example, in this case, price was the here, I have taken 25 W0, 25 plus and 15, this is the price. Okay, so I have taken random value of B0,

that is 25 random value of b1 that is 15 is it clear to everybody up to this moment every everything is clear first step of the training draw a random line i have explained how to draw a random line got it so first step is over and suppose it's depend on what value you are taking suppose these were the data points you cannot change the data point because they comes from the data set for example first random line you have drawn this this is the first line up to this moment i have explained everything is the first line i have drawn there is a random line okay is it clear now now i will i will predict i will predict the price of the house price of the house using this first line. First line or linear regression model. This is the first model you have drawn. This linear regression line is nothing but a simply a model you have drawn. Now I will predict the value of price. How you can predict the value of price by using this line? Any idea?

Okay, suppose this is the size of the house 100 for example, this is the size of the house 100 and price is 25 lakh, suppose. Okay, I need to draw a vertical line on the model and corresponding value of y-axis. Suppose value of y-axis is 10 lakh. Okay. So the target value is what? 25 lakh. That is the original value that is coming from the data set. And what my line is predicting, my model is predicting 10 lakh. Okay. Is it clear? Every data point you need to map on the line and corresponding value of the y-axis is the value of predicted by your line. Okay, is it clear? I have explained how to use this line or model for a prediction purpose. Any doubt? Yeah, it is also here in this diagram. Wait, yeah. Okay, suppose random value of theta 0 is 4. In this example, theta 1 is 0.02. This is the line. X axis presents the size of the house. Y axis presents price of the house. These are the data point and that is a real data values

and first model I have trained and the model is predicting the price of the house that is corresponding to the y-axis. Agree? So, yes, there is a difference between what is target value and what your line is predicting. Okay. This is clear? Everybody? Okay. So, yeah. So, this is the table, very important table. Please understand. Please understand this important table. So, this is the house size okay this is the target variable and this is the predicted price from your model so target variable your true price was 35 of the house of 1000 square feet house of 1000 square feet real price is 35 lakh real price is 35 lakh but when you map on the line it will predict around 24 lakh okay the table is clear so this column present the target variable ground truth and next column present what your model is predicting against every input and the last column is the error because error means what the deviation and in mathematical you will say the difference between target

variable and predicted target value and the predicted value the difference between these two value we call the error. Okay. Is it clear to everybody up to this moment? Great. Great. So, how to calculate the total error? Tell me. Total error. According to you, error 1 plus error 2 dot dot dot dot error n. n means total number of observations from the training data set. okay for this example one two three four four observations were there every observations will contribute some error it may be zero may be positive may be negative agree so you need to calculate the total error given by your this line you need to sum it okay yes so yeah some of the errors are positive i think everybody understands some of the errors are negative so it may happen if you add these errors together the total error may be zero or close to the zero close to the zero so this is not a right way correct way is that what is solution of this problem there are two solutions either you can use the absolute value okay like

that. It will give you total error. Agree? So, we call it total absolute error. We call it this formula total absolute error of your model. Okay? This formula is clear. What is the total absolute error? It is clear to everybody. Another formula. Another formula is square it. Square of each error like that and then adding. This is called SSE. SSE means sum of squared error. Very famous term sum of squared error. Agree? I am just an introduction of new term. Total absolute error, sum of square error, both things should be clear to everybody. Great. So, it's not a right way. Again, this is not a right way. Why? Because here total error in both the way total error also depends on depends on size of the data. Size of the data. If the data set have more number of observations, you will feel it will offer more larger error. So what is the solution of this problem? Mean absolute error, very famous term. Mean absolute error. What is this? Same formula

just we have seen divided by n. People use this formula because it is independent of the size of of the data set. Similarly, average or mean sum of square error is a better formula. Okay? Yes. So now you have two options. Now you have two options. Option A, mean absolute error you can use or you can use average sst agree there are many more options this is not a right time to introduce here there are many more options okay whatever the option you will choose it will give you different model it will give you a different model the performance of model will be different That's why I discuss today at the starting of the lecture. The moment you will change the underlying idea of training, you will have a different model. There are many options. Either you can use mean absolute error, you will get a model. You can use average SSE, you will get a model. And there are many, many, many, many more options. So, in the real time, in the real application, what happens if you are from the industry,

real application? Hit and try. There is no correct answer. Hit and try. Which method will give you the best result? You should choose it. Okay? Just my objective is to make it clear there is no any fixed path of the training. During the training, there are many options. Whatever the option you are choosing, it will impact the quality of the model. Okay? is it clear to everybody great now come to the least square method you may be wondering what is the least square matter of training least square method use this formula average ss agree if you are choosing to calculate the total error average sum of square error this concept we call the least square method ok again why we are squaring the error you answer you answer it first why we need to square the error I already covered it answer is not here answer is why we have done absolute error because there are some positive errors if you don't focus during the discussion such questions

will come unnecessarily I have answered it Some errors are positive, some errors are negative. They can cancel each other. So ultimately you will be misguided, you will see your model error is total zero or close to zero. You will be happy to see that your model is very good. But it is not coming because of the performance, because of the errors are positive and negatives. So to solve this problem, we have two methods and many more methods. So one of the method is squaring each turn so that negative turn will become positive. Okay. So everybody got it? What is the least square method? Okay. Now, now the question is how to reduce. How to reduce the error? This is the next question of the training. I am covering the training. It is not completed. How to reduce the error? You tell me. Yes. Correct answer, Jitain. Yes. so answer is here hypothetically I am answering okay you understand so this was the initial setup assume that

yeah suppose is the first line I have drawn okay so I am mentioning here the first line now I have to draw many more lines agree like many more lines many more lines many more lines many more lines here okay So this is suppose line number 2, line number 3. A model you can say the model 4, model 5, model 6. Similarly, we have a M number of model can be there. This idea is clear. And every model we have to calculate the total error. Total, I'm mentioning here total error 1, total error 3, sorry this was the 2, total error 4. this total error 5, total error 6. Is it clear? So, suppose, suppose you have drawn or you have a model, you have drawn M lines, M models. Okay. Okay. So, for a simplicity, I am saying M1, M2, no, no, like, like, L1, L2, L3. These are the lines, dot, dot, dot, dot, dot, dot, M number of lines. Each line will give you some total error. So this is, I am explaining total error 1, total error 2, total error 3.

Similarly, total error M. Is it clear? so which line you will select question is that which line you will select as a final line as the as a final line or final model yes least error correct answer. The line which offers the least error. Correct answer, correct answer. Line is minimum error. Sometimes we will call it minimum error. So because of this word least, this method we call it what? Now you can connect everything least square because we square the error. So, least square method because of this concept. This training method is given the least square method. Okay. So, suppose, suppose, please focus over here. Suppose there are many lines you have drawn. Okay. And suppose this is the best one. Agree? Best one means what? That is we call it the line which offer the least error. Okay. So, suppose this is the best line. This is the best line. Okay. Now, you need to see suppose this is the cut at the y-axis. Suppose it is 10 and angle with the x-axis is 5. So what will the final

model here? Final model will be price is equal to 10 plus 5 size. That is the your final model. Training is over. That is the final one. I hope everything is crystal clear now. up to this moment. So what was the objective? Objective was to estimate the value of b0 and b1. So this is the way we have estimated the value of b0 and b1. You don't need to worry about initially what I answer you don't need to calculate the value manually. It comes through the data set. It comes through the training process. you don't require anything else to calculate manually now that what is clear to everybody great okay the most important part who update the weight who update the coefficient you tell me because the first time the first time what you have done suppose this was the price and random value you have taken 25. Suppose this is 30 and this is the size. This is the first line. Agree? First time random line you have drawn. Is it clear to everybody? Random line you have drawn.

Okay. But when you have to draw the second line, you have to draw the second line. Yes, second. How you are going to change these value? Either you want to increase or you want to decrease. tell me. That is a million dollar question. So, how this value you will estimate? How are you going to update? You are going to increase or decrease this value? Okay, based on the error, how do you decide should I increase or decrease? Okay, suppose average error is 80, tell me. what you will do? You will increase this value or decrease? Tell me. Suppose average error is 80. Now tell me. Okay average error is high. No, no, no, no, not at all. Totally wrong answer. How you are deciding with the error? Suppose it is not 80. It is 800. Then okay. So you all are wrong. Answer is here. That is the last discussion. Last discussion. We need optimizer. We need the optimizer. This is not manual process. Every time you just come into the loop. No, optimizer.

You need to use the optimizer. Who will update the weight? You don't need to involve manually? Who will update? Who will update the coefficient? There is no any human involvement. Agree? So who is the optimizer? There are many options. Again, there are many options. There are many options. The most famous, the most famous is what? Gradient descent. I will not cover it. It is a part of deep learning. The gradient descent. It's a responsibility of the gradient descent to update, to update all the coefficients. It is maybe b0, maybe b1, there may be n number of coefficients. update the weight such that such that in every iteration in every iteration it reduce total error. Got it? We are not going to learn what is a gradient descent. You need to understand the objective of the gradient descent. It is okay. So whatever you were thinking, this is your work, your work will be done by the gradient descent. Okay, there are many variants of the gradient descent.

Like somebody here written a stochastic gradient descent. It is a very good batch gradient descent. Adam, there are many, many, many, many, many variants out there. Is it clear to everybody? I have completed the linear regression. I have completed the linear regression. Come back to the diagram. Yes, everything is written. Look, each square, each term you need to square it, then sum it. Objective is to minimize it. Okay, this is the formula of calculating the error. This is real value, target value minus, this is a predicted value. Square it, you will get the error. Okay, we call it sum of square error. Okay, yeah. Now, come on back to the screen. Somebody has already asked this question. It is possible to have multiple variables. Why not? This is another example. Suppose we have a data set having a two input variable, the size of the house plus number of bedroom in the house. So, now we have a two input variable and output variable is always single.

So, now here we don't need to draw a line. Here it is now the three dimensional view. We try to draw a plane or hyperplane. Okay. So, the equation will become different. Like here price is equal to theta 0 plus theta 1. First input variable area. Then next input variable number of bedroom. Else everything is same. you need to use this plane to predict the value. Real value is this one. Target value is this one. Predicted value is this one. These are the errors. Again, you need to square it, average it, apply the gradient descent. It will update the weight until you will get the least error. So, now number of feature does not make any difference to understand the concept of the linear regression. Agree? Very simple. Very simple. Okay. This is the multiple linear regression because we have more than one input variable. Okay. Great. Now, the last part we are discussing here. Adjunctions are not going to cover here. Leave it. Yeah. Now, the last topic for today

discussion polynomial polynomial linear regress agree last important part thank you Rahul if it was a machine learning I take two to three two to three session two to three session to complete the linear regress if today I have to cover all that stuff into one session only because our subject is not machine learning. Our subject is more about deep learning. So I'm running in very fast manner. Otherwise you will enjoy much more. Okay, leave it. Suppose I want to predict a muscle power. Can you? Muscle power. Muscle power based on the age of a human. Agree? I want to predict the muscle power. This is the value that I want to predict. An input variable will be what? Age. Input variable. Okay. So, what is the relationship between muscle power? Can you draw? Muscle strength, yeah, muscles power versus age of a human being. What is the relationship between these 2 variables. I think everybody agree it will be like that. Age and muscles power. It will be

like that for a small suppose it is 1 year then 2 year then 3 year then 20 year then 30 year then 100 year like that. So it will be like that. I think everybody agree? Agree? So now tell me the relationship between muscles, power and age is not linear. Agree? Everybody agree or not? So in this case, simple linear regression or multiple linear regression will not work. I think you also should be agree with this will not work because the relationship between input variable and output variable is not linear. So what you have to do in this case, we need to draw a curve. We need to draw a curve, not a line. So whenever you draw a curve, not a line, we call it polynomial linear regression, polynomial linear regression. After this moment things are clear, great. So suppose the data set is given to you, age versus muscles power, data is like that, okay. Data is like that, okay. So suppose you are trying to draw a linear regression

line, I think it will be the best line. This line will give you the least error. Assume that you have drawn, you have trained the linear regression line on this data set. So suppose this is the final line. Assume that. But this line is not following the way the data is distributed. Agree? So you don't want that line because this line will not give you the satisfactory result. you want a curve that will follow this data distribution. So, it will be the better model. So, how to achieve this? How to achieve this? Through polynomial linear regression. That is the idea. Okay, so in this case, what is the characteristics of the polynomial linear regression? Suppose this is a y, this is b0, b1, here whatever the term or feature you are using, the degree of polynomiality you can change like that, like that. Okay, so because of the degree of these features are not linear or not single, it can be anything because of that

we call this polynomial. The degree of polynomials will be different. Yes, Mohit, you are correct. You can call it polynomial regression. It's better format. I agree with Mohit. Okay, by visualizing it. So, Joginder, by visualizing it, you need to visualize the relationship between input variable and output variable. Okay, Joginder, now you may have a question. Sir, how do you know these features the degree of degree of probability should be 2 or 3 or 4 or under root or square root it's again hit and try final answer there is no correct formula hit and try okay so this is the example I have given suppose this is the age is the salary I want to predict the salary of a particular person based on the age. If you try to visualize, you will sense it. The relationship is not linear. This is the right curve that will fit on the data. But if you try to draw a line, you can do it like linear regression salary is equal to theta 0 plus theta 1 age. But that will

not give you satisfactory results. Error will always be higher size. So, solutions are there. You can increase the degree of polynomiality. Like theta 0, theta 1 plus h plus theta 2 h square. And you can add in many ways. What will be the correct equation? Nobody knows. Hit and try, hit and try, hit and try, hit and try. Okay? Yes. Yes, like that. If there are many more variables, you can add and you can play with the degree of polynomiality. So yes, Muthu, people are using both the word, either polynomial regression or polynomial linear regression. So it doesn't make any much difference the way you like you can use the term. Yes, there can be multiple points. In this case, it will be a polynomial curve. Okay. Anirudh, in that case you will have a 3D curve. So now because it's just a recap, my objective was just the recap of the linear regression I have covered it. Now this is your Your duty, understand that your duty to study in detail, you study in detail.

In detail. Agree? Whatever the my responsibility, I have taken the extra pain, extra time to cover the linear regression. There are many more things in the linear regression, many more things. So please refer other books, video and other sources. Okay. a small announcement next class next class okay on i think it is uh next tuesday i'm talking about tuesday agree it is uh uh 8th september itself so there will be no class i am on the leave there will be no class okay you will get a notification don't worry about that this is a simple announcement The next class of the same next class in this week, in this week, it is on Saturday, I think, Saturday, it will be there as it is. I'm talking about the class on 8th September only. Other class will be as it is. Only 8th September. Okay, in this week, Saturday, there is a class, it will be there. Okay, so thank you. Time is over. You may be waiting for the next class.

uh okay so we are going to leave it here and and if you have any questions you can ask in the next

