[00:11] Today machine learning is behind so many things we use every day from product recommendations and fraud detection to price prediction, chatbots, medical diagnosis and even self-driving technology. But machine learning is not [00:24] computers to learn patterns from the data and make predictions or decisions. this course. We'll start by understanding what machine learning from AI and deep learning. Then we'll explore the main types of ML, especially [00:39] supervised learning where models learn from the data that already has known regression where you'll learn how machine learning models predict continuous values like house prices, sales, revenue, or customer spending. [00:52] regression model using Python and scikitlearn. You will learn how to split data into features and labels. divided into training and testing sets. Train the model and make predictions. After that, we'll understand how to check if [01:05] evaluation metrics like mean squared error, RMSSE and R square. Then we'll look into common problems like overfitting and underfitting and learn regression help improve model performance. We'll also cover important [01:19] pre-processing steps like scaling, one hot encoding, pipelines, and column workflow becomes cleaner and more practical. Once regression is clear, we'll move into classification where the goal is to predict categories like spam [01:32] no disease. You will learn classification models like logistic regression, KN&N, decision trees, and support vector machines. We'll also understand important classification metrics like accuracy, precision, [01:45] recall, F1 score, confusion matrix, ROC curve, and AU. Finally, we'll touch on advanced classification concepts like multiclass classification, multi- label classification, imbalanced data sets, oversampling, unders, and ensemble [01:58] will understand how machine learning models are built, trained, tested, evaluated, and improved using Python. So, let's get started and learn how if you interested in mastering the future of technology, the professional [02:12] learning is the perfect opportunity for you. Offered in collaboration with the NCAT Academy IT Kpur, this 11-month live and interactive program provides hands-on expertise in cutting edge areas like genai, machine learning and tools [02:25] such as charge GPT and hugging face. You'll gain practical experience through live master classes delivered by esteemed IIT Kpur faculty. Alongside IIT Kpur, you'll receive official Microsoft badges for Azure AI courses [02:40] and career sport through simply learns job assist program. Hurry and enroll description box and pin comments. So let me ask you a quick question before we start. Which ML type learns from the data with correct answers? A supervised [02:53] learning, B unsupervised learning, C deep learning and D reinforcement the comments below. >> These are available and almost like self uh content available. Not nothing much into this. This is just theory part. [03:07] section first and then we'll move on to the more important part that is the conceptual things. So in the first presentation that is machine learning first part we're going to talk about the course introduction [03:20] essentially we're going to talk about what is in store for you so what are we going to cover up what are the topics we will talk about those things so that's your learning part here it goes we'll talk about what is machine learning that [03:32] will be the first lesson introduction to machine learning all theory into that different kind of machine learning what are the types of machine learning what where is what is what I will cover up in this course what [03:45] everything I'll cover up into that but first particular presentation first particular presentation >> from after this we will move on to the supervised learning techniques and we'll start with the regression algorithms [03:59] we'll understand what is regression why regression what is the algorithms that we use in regression what is the mathematics behind them how do we apply them where do we apply them right everything will be covered up [04:12] We'll cover up more models into that. Uh we'll try to cover up the variance of regressions. We'll also cover up some optimization techniques into that where we try to optimize the models. We'll understand regularization techniques. So [04:25] that too as well. As soon as we reach onto that topic, I'll give you a going to cover up and do this course. going to cover up in regression course. Then we will have supervised learning [04:39] algorithms of classification four or five algorithms the basic algorithms we'll start with them and then move on to the advanced algorithms or we'll move on to the onsembling techniques as well in this course at the later stage [04:51] >> but we'll look into different types of classification problems multiclass multi classification problems multiclass multi label and the variance right all kinds of examples which is possible in this kind of scenario because In real [05:07] world terms we would see that we will have majority of the problems that we have majority of the problems that we solve are classification [05:19] between classification and regression we talk about in supervised learning. So yes uh regression we will talk about lot of algorithms classification we'll talk algorithms which are common to both regression and classification. So we'll [05:33] cover those algorithms while dealing with the classification part. with the classification part. Moving on, >> we will have assembling techniques. That's a great way to combine or [05:47] join together multiple types of models. How do we join them? There are multiple approaches to that. We'll discuss all those right enhancing the performance of my models. Then we'll move on to the different leg of class of the machine [06:01] learning algorithm we call unsupervised algorithm. in which we will learn about majorly three categories. We'll learn about the clustering techniques. We will learn about the dimensionality reductions. We [06:14] about the dimensionality reductions. We look into the anomaly detection as well. look into the anomaly detection as well. Right? classification as well, imbalanced class problems. So a lot of things will come [06:27] up under the unsupervised learning guardians. Then we finally move on to the last topic which is recommendation systems. uh there in we will take up a Netflix data set and we'll try to see how Netflix works on the movie [06:39] recommendations. So that's what the real world example we will have different techniques how recommendation system works. There is you know or user based uh filtering or content based filtering or algorithm [06:51] based filtering like support vectors or not support vector but singular vector machines right so we'll look into that everything will be coming into the picture essentially that would be the all topics [07:04] we have six lessons to cover up and I will count it as 12 days only 13th day we I left devote onto the project work so we'll spend a little less time on [07:16] complete theory part some basic theory things concepts and practice is the maximum time that I'll devote into right there is one uh simple request that I would like to have now essentially I can tell that I know approximately 7 to [07:31] eight programming languages including Python coding is my blood I love it course component wise few things like you have hands-on exercises which I'll do with along with you course and project we'll discuss on the last day. [07:47] available into your learning management portal. You can download it from there. So any PPTs that I show up on the screen they are available as PDF documents on reference material get in touch with the LSM she will arrange the things for you. [08:02] Good. >> Great. Okay. So we have presentation number two. That's essentially the last presentation that I have. Beyond this I don't have any presentations to show up because this is the last theory thing [08:15] after beyond this I have only concepts to deliver there's not too much of concepts into this so we'll talk about this now >> and we'll start with the point that what is machine learning [08:30] learning so I can expect some responses onto that what is machine learning or those who are not aware can give me a generic idea Whatever they think, what are your opinion about what is machine learning [08:50] side but there I have a chat window I am looking onto that so I can read the looking onto that so I can read the responses quickly. So team be aware that uh I will try to respond as quickly as possible because I am doing the live [09:03] chat monitoring on the right side of my screen. I have another machine screen. I have another machine Anybody [09:27] learn from the data great computer learn the data computer learn the data good M is a branch of ML is a branch of AI Yep. Machine that learns from exposed data. Good. Manath. Ability to learn [09:41] patterns from minimous data uh from human behavior. Uh getting into the behavioral science. Good Sulman. Good. None of the responses are bad. All are None of the responses are bad. All are good. [09:57] to a very small or very conceptual level. What exactly we are trying to achieve, right? What is the purpose or what is the basic role that machine learning has? Learn from the data and improve performance [10:11] data and improve performance automatically. Agreed. [10:26] Now let me just bring it up for you. Now let's imagine that a very simple problem idea behind is problem solving. we need to solve certain problems. The entire concept or entire purpose behind the entire [10:40] industry I will say that is to solve problems whatever the nature of problem is how but we trying to solve a problem so I'm bringing into a picture a very simple problem for you right the problem is that I want to add two numbers [10:56] is that I want to add two numbers is it simple adding two numbers what we have is a machine right we have a machine let's a computer right what [11:12] you will do to this machine I will give the inputs to this machine I will give the inputs input A suppose and input B there are [11:24] two numbers I have given those inputs now what is going to happen now what is going to happen I need to write down a piece of code I I need to write down a piece of code I have to write down a piece of code [11:37] that will add A and B together and this machine will process this code and give machine will process this code and give me the output. [11:51] Do we agree on that? That's the traditional approach of programming. Now into this into this let me ask this. Who writes this code? The code is written by people like you [12:05] and me, right? engineers, whatever you want to say, MSD, whichever profile you want to take. [12:17] But that code is written by people like you and me, acceptable. Now, in order to write these codes, we require some skills. There are certain skill sets that's required. You should know the programming language. You [12:30] should know the data structures. you should know the algorithms and should know the algorithms and everything. Does that make sense? In order to effectively write that code, it says that [12:51] instead of doing this to the machine, I will direct a certain pieces of algorithms. So these algorithms are pre-written mathematical concepts, pre-written concepts, right? These algorithms are basic concepts of [13:04] mathematics or statistics or somewhere else, right? Of some neural concepts as well are there. But these algorithms I'll supply to this machine, right? And I'll supply to this machine, right? And to this machine along with the inputs I [13:19] to this machine along with the inputs I will also tell what my output is will also tell what my output is what my expected output is. Now while solving a problem in traditional approach we know what are the inputs we [13:31] know what are my expected outputs. What we look is a pathway to reach from input we look is a pathway to reach from input to the output. Correct? Now here again I know what my inputs are. I know what is my expected outputs are test cases right [13:47] house >> good so we'll supply those to machine >> good so we'll supply those to machine and let the machine decide to find out the relation between input and the output how can it reach from input to [14:01] the outputs and what it is going to generate is a piece of code the machine is going to generate a piece of code we generally call that as a model. >> What we get is a model out of it. [14:18] Good. It has solved my problem. It has given me a potential solution by which when I give the inputs A and B, >> I am expecting it to give me an output [14:30] >> I am expecting it to give me an output >> as the it will give me an output. This >> as the it will give me an output. This output I will say as my prediction. Now how good or bad is that output? I can compare this output from what my [14:43] can compare this output from what my original output was >> right now in this scenario what is the role of a human just like people like you and me what's the what's our role do I need to make logical coding for the [14:59] model no >> so do I need to know about data you do not have to >> what you need to know about is what sort of algorithms because these are let's say there's thousands of algorithms [15:13] available right out of those algorithms which algorithm is applicable to solve this problem so I need to make or I need to just tell it that okay in the pool of to just tell it that okay in the pool of 10 choose this one so what we have to do [15:27] is the selection process make sense and come out to a conclusion that out of the all algorithms which one is doing the best [15:51] have to give you a contextual definition or theoretical definition, machine intelligence, right? So, if you talk about AI, AI is a bigger picture. [16:03] >> Is it bro? AI is a big picture. Into that AI, we have a subsection called as ML. >> That ML has another subsection we call it as DL or deep learning. And DL has another subsection we call it as [16:18] something foundational modeling. [16:30] AI is a very vast field because AI also involve robotics. It also involves some neural network lot of things are there into AI. So AI is a very big term within AI. Machine learning is a sub part of it. So what we are learning in this [16:44] course is only the machine learning concepts. We are not going into the AI part. We are not going into the real part. We are not going to the FM part. follow up with a later later in the course. [16:57] >> So it's a branch of AI >> to remove or something. uh typically that's what I can say about machine learning which learns or which [17:10] machine learning which learns or which understands the data or pattern right about the data right it learns from the data it gets understanding from the data and tries to give me [17:26] and tries to give me >> course so I'll just add the PPT and solution to a problem it gives me solution to a problem and It learns by experience. The more amount of data, the more exposure to the information that it [17:40] more exposure to the information that it gets, it gets better and better. Right? So what I'm trying to make is intelligent computer. Now if you talk intelligent computer. Now if you talk about the word uh machine learning [17:53] about the word uh machine learning it was uh [18:06] remember rightly Arthur Samuel he quoted this term somewhere around 1950s I exactly don't remember the year but somewhere in 1950s he quoted this term [18:18] So, so ML if you talk about machine learning is not a new concept. It's a concept that was there way back in history right early 1950s or maybe somewhere around 1960s >> ML was there. The only thing was it was [18:34] not applicable or it was not being used practically because of its cost. Machine learning was you know very uh was a very cost consuming activity and if you go back in time you will see that the cost of machine cost of data management cost [18:50] of processing instructions was very very high. These days it has become cheaper. Cost of storage is cheaper now cost of processing instruction is cheaper and [19:03] as compared to the machines that we had earlier. So that's the only reason why we are seeing a you know a surge in the field of AI because the computational cost has decreased a lot and it's keep on decreasing right now right [19:23] enthusiast machine learning enthusiast so you should be aware about or you should have been following the recent developments in the field of AI can you most recent >> uh thing that was in news artificial [19:37] >> uh thing that was in news artificial intelligence. Anybody? [19:53] Open claw. Chat bots. Cloud AI. Yep. Cloud AI. What version? Open. Open claw. Open claw. It was opus 4.6 if I'm not wrong. So [20:17] it has created lot of things many things juggled up around the world. Nonetheless, so team we also need to look into the perspective that learning look into the perspective that learning the coding part is not as important then [20:32] more important part is why we are doing that always try to focus on why we are doing it right not what we are doing because these days we have certain very very good AI tools like focus 4.6 We have [20:46] I've not tested it yet. Uh we have GitHub copilot, we have Microsoft's copilot version as well. Uh we can use Gemini. [20:59] generates the code for you based upon a simple prompt. So I will not try to bother little bit too much about the coding part. I will do live coding with code means for you so that you understand why we are doing action, what [21:15] action or what it completes up for us. We'll do that. But the point is uh if to you, no problem. But understand the concept more. Is that okay? [21:31] In the field of machine learning, why is more important than what [21:47] systems to learn and improve automatically programmed. So we're not programming a machine. We're just letting it know. [21:59] machine. We're just letting it know. Good. Art assemble 1959. So correct my year. Okay. This is a quick uh difference between a traditional approach. We have discussed that and machine learning [22:11] approach. I would like you guys to give that a quick read. intelligence is a bigger picture. >> Within that we have a subset called as [22:24] ML. ML's subset is deep learning. deep learning subset is foundational models learning subset is foundational models FM [22:38] say that foundational models many people do not talk about foundational model explicitly but for example there are certain models like let's say bird if certain models like let's say bird if someone has heard about bird or llamas [22:51] all these are very basic foundational models which are developed on based of some research papers so these the foundational model that stands as my base models when I try to create a certain different kind of models in in [23:05] certain different kind of models in in the field of AI. So yes, these are typically based upon deep learning concepts. a subset of deep learning but a separate branch of dealing with the core models which are trained up let's [23:19] say for example chart GP chart GP itself is a model right so that model has been trained upon a humongous amount of data I cannot train it up on my machine but I can still use its feature to create my own chart or kind of thing right so that [23:33] is what we call it as a foundational models the basic models that are there learning Amazon Alexa is an example but I would not say that as an example [23:48] Amazon Alexa because Alexa has improved over the period of time. Alexa now understands natural languages as well and can process and take up you know AI decisions as well. So yeah decision making process has improved in Alexa. So [24:01] Alexa cannot be considered just a machine learning. In machine learning we are only doing the prediction giving a generic idea right. It's Alexa will fall into the category of deep learning. Now lesser than [24:15] right then we come to the deep learning example. Anything which is expected that only human can achieve are done by a machine is deep learning. Right? Anything that expected is only human. Like say for example I write my can I [24:29] write down something on my handwriting. Okay. I change the color of a picture. Right? A painter can do it. A human can do it. have a machine do it. Right? So that's what for example you need to edit your [24:43] photograph and make yourself a little bit more you know brighter and sharper. require a human intervention. Can I do it without human intervention? The answer is yes. How deep learning algorithm? [24:57] You say a word in Chinese and it can be translated into any language automatically. Right? You see the uh notes coming up right in front of the screen. Whichever language you choose. Let's say I'm [25:09] understand the things in Hebrew. You have choices available to read my text or read things read the transcripts in Hebrew as well. These are things which are available through deep learning concepts. Good. [25:29] Now let's get some into the history of machine learning, history of AI, [25:43] Typical example which is given to you on the screen is about a chess. a chess. When a machine or a computer and a person plays up a chess, the computer uses the moves by the human in order to understand and learn more and decide its [25:59] future action. Right? Can someone tell me the name of Right? Can someone tell me the name of the machine which defeated? So it was a simple machine, a very simple machine at that point of time as compared to the [26:12] standards that we follow today, right? that was able to defeat Gary Kasparov. champion at that point of time. Second one was Vishwanatan from India [26:27] who later on became the world champion. That's a separate thing. That's a separate thing. The 8x8 square board in chess in go we The 8x8 square board in chess in go we have 64 by 16 by 16 if I'm not wrong. [26:39] So lot of spaces there. It's a more complex game as compared to chess. A machine was able to defeat that too was able to win the go game as well. The name of the machine that won that game was Alph Go [27:02] same. I am going to create machines that can perform certain task. Problems can solve my problems right. But in order to solve the problems, I am not going to tell it how to solve the problems. It [27:17] will learn on its own how to solve that particular problem. It is going to learn on its own. The only thing that I'll tell to the machine is what processes or tell to the machine is what processes or what steps you should follow. [27:29] Are we good? That will be the basic idea that we'll try to do would be the machine learning part. Good. Where is machine learning used? anything, we have machine learning there. In current day scenario, anything [27:44] that you think of connected to electronics, machine learning is always there. Anything these days, spam filtering, your emails gets filtered, your resumes get filtered up because of machine learning. When I do a social [27:58] media analysis, any kind of analysis on social media, what is in trend, what is not in trend, machine learning, any kind of customer service, chat bots, these are deep learning concepts, online recommendation systems, again deep [28:12] learning concepts and some part of ML sentiment analysis. You will rate me at the end of session, right? I will look into your comments and find out how is the sentiment of the session and I'll try to alter my leaving [28:27] footprints and everything is being utilized by the word in order to utilized by the word in order to generate certain data. learning. A very basic understanding of leaving digital footpr foot footprint. [28:42] leaving digital footpr foot footprint. You take up any Google search or meta search and search for anything. Let's say I search for a com, right? Then start playing a third party game anywhere. You will see ads of that com [28:57] only. Anybody experienced that? You search on a different site about something and later on you start seeing the ads on the later on you start seeing the ads on the same thing on your machine [29:16] recommendation system works giving you small example of recommendation system many of you would be fond of watching shots maybe also on video streaming platforms you might see some smaller shots like like Instagram Instagram, [29:31] people like YouTube or anything of those formats. Have you ever observed that if you try to spend a little time on certain types of shots, [29:43] later on you will see the similar kind of shots coming up in your scrolling of shots coming up in your scrolling list. [29:57] shots but you will see the one that you you know prefer to watch out who gave little more than 2 seconds did not scroll back to the next for in within 1 second or 2 seconds. Usually it's a 2C timeline. If one person spends more than [30:11] 2 seconds on a particular video that is considered as area of interest organization have their own standards but usually two. So I'm talking about a [30:26] very basic understanding that what machine learning can achieve for us. Are machine learning can achieve for us. Are we good? [30:44] we'll have some basic understanding of what is machine learning, what are the different types of machine learning where it is being used. Right. So as I told you in machine learning we have a pool of algorithms. [30:58] So what are these pool of algorithms? These are predefined rules, predefined structures which a machine can use to establish the relation or solve a problem. I use the word solve the problem because not every time I [31:13] want to establish a relationship but there is some kind of relationship activity that will happen either in supervised unsupervised or reinforcement or semi-supervised wherever you go all four categories of machine learning we [31:27] will have some kind of relationship that is being established by the machine is being established by the machine right objective in this course is to teach you those algorithms, how those algorithm [31:42] work, what is the basic understanding of those algorithms, how does they help in making decisions, right? What we are going to use algorithms for, we're going to use predict the outcomes, classify the targets, improve the performance of [31:54] the models. So, a lot of things will happen very important aspect. This is very very important, very very critical for us. [32:14] while you're developing with the machine learning problems, two things. The quality of the data and the quantity [32:28] The quality of the data and the quantity of the data. I cannot have a very small data and still solve a problem. I cannot have a huge data, but that's not This small little chart talks about the importance of quality data and quantity [32:43] importance of quality data and quantity data. Right? So, [32:56] point of time uh at some quantity this will become flattened right and this is also going to flatten out at a later stage. So after certain point of time there is no increase essentially not in machine learning but [33:10] if we talk about the deep learning algorithms the moment quantity increases algorithms the moment quantity increases it goes in exponential way like this. [33:23] better than machine learning models but in some small certain problems machine learning models are more effective as compared to deep learning. So both things are important and secondly why we need to learn machine learning when when [33:37] deep learning is more into the world is very simple reason it's not possible to get into the deep learning because you will not understand how deep learning works or without understanding the concepts of [33:52] machine learning maybe in real world scenario as date most of the things that are used in real world is deep learning concept machine learning is kind of Machine learning is not practically used. However, in order to build your [34:09] understanding about deep learning, it's very very important to get to know about very very important to get to know about the machine learning first. Good. [34:52] learning. Anybody aware for different types of machine learning that we have? I have taken those four names right away 10 seconds ago maybe 10 minutes ago. [35:09] four categories. There are four types of machine learning. We have supervised, we have unsupervised, then we have reinforcement and we have semi-supervised. [35:24] So these are four categories of machine learning out of which we are only talking about the two in this course the supervised and unsupervised. [35:38] reinforcement learning. We are partially dealing with the semi-supervised Reinforcement learning in itself is a different topic. U out. >> If we talk about the market of [35:54] video to you about reinforcement learning right in a short while from learning right in a short while from now. [36:08] which the machine learning is divided. Supervised learning, unsupervised reinforcement learning. Let's have example. In supervised learning, what happens is we will have a data right in that data I [36:23] will have some features. That means I will have columns that I'll use to will have columns that I'll use to predict an outcome. I will have a target right. So I'm going to make learning based upon inputs and outputs. I will [36:36] supply my inputs. I will supply my outputs. The machine is going to learn from both inputs and outputs and generate a model and this model will be generate a model and this model will be tested out for us. Good. So that's a [36:49] typical example that you can see here. I'm sorry. So in supervised learning what we will have is a labeled data. [37:04] labelled. What is the use of labeled data? Anyone who uses meta business called as meta earlier it was called as Facebook. [37:18] If you go back in history you might remember some of you might that at some point of time in history it used to ask whenever someone p some persons ask or uploads a picture it tells that tag the person [37:33] person in the pictures. person's a square onto that person's face and write it down the name. Anybody face and write it down the name. Anybody seen that before in the past meta? [37:54] you upload a picture it does an auto tagging. want to tag it up. That's a separate thing, right? [38:14] tag the people, what it was doing is it was collecting data to train its model was collecting data to train its model to do the tagging or to identify or creating the labels because creating labels for data is not an easy job. You [38:29] need a lot of time. You need a lot of things, right? very famous competition wev call it as that contains [38:42] call it as that contains approximately I guess 25 million images are there into that and models are trained on those 25 million images. Those 25 million images were randomly captured [38:59] >> and are labeled manually in order to create the label. So a labelled data that means I'm telling that what does a particular input for a [39:11] particular input what is the output. So that is its label right or the target value. So if I have a target to predict I will say that as a label the data and I will use that using the supervised machine learning [39:25] algorithm. If I have to predict the target are we good? have a target to predict. I have certain data which contains only the inputs. No [39:41] output is available to me possible. Right? In this scenario, we what we do is we do a grouping, right? We do a grouping of the data. I'll use the word grouping. Either I will try to see what rows are together [39:55] which are of similar type. If any groups can be made out, two groups, five groups, 10 groups, whatever number of grids or maybe if there are columns which can be grouped together to create something. So column-wise [40:09] grouping, row wise grouping, right? When you do a column-wise grouping, we call that as dimensionality reduction. When you do it for the row wise, we call it you do it for the row wise, we call it as clustering. [40:23] we call these process of grouping the data where I do not have the target but we look into similarities or differences in the datas to find out what we can manage together. Right? That is what we call as unsupervised learning. I do not [40:37] have the labels. That is why not supervision. more about the names. Right, this slide talks about some [40:51] supervised machine learning algorithms. Linear regression, we are covering logistic regression, we are covering, SPM, we are covering all four apart from this which I'll cover up in the upcoming time. Let's get into the [41:06] the upcoming time. Let's get into the unsupervised learning, right? here >> we have unlabelled data [41:18] >> we have unlabelled data >> and if I have to segment the images find out different things in image object group user group based on commonalities anameies over geographical landscapes so essentially unlabelled data avenues [41:33] where I do not have a target very in basic layman terms I can say that we work what is the purpose for this is a typical example where I can showcase the [41:46] >> case for this then I'll just put this log and go inside >> I have a group of people I do not know who is what there's a herd of people coming up people I will try to interpret some logic and it has divided the people [42:02] into different categories 1 2 3 they all have some similarities between them this is a group of females. >> You have case for this. >> Yes. >> This looks like teens. This look like [42:17] >> This looks like teens. This look like kids. This look like old people. This may be families. Could be anything or whatever. Young women, young people. [42:29] >> Okay. >> So, because he gave me an classification. I'm not bothered. >> But the point is as per my decision-m [42:45] commonality that I was looking into the groups, >> I am able to create labels. What will be the advantage? >> I will be able to create labels onto this. [42:58] >> Suppose this is my feature. I have certain things I have categorized that okay, this belongs to category one. So I can create a category one feature over there and I can later on use this labling label data to apply supervised [43:11] labling label data to apply supervised classification algorithms to help it out or solve problems. So if I have unlabelled data I can use [43:23] unlabeled or unsupervised machine learning algorithm to label the data. I can use that. That may not look very convincing but yes. [43:41] Now I checked that I call is not lifting. So I'm working on them. No option. No then the video can't go without thumb inside. [43:55] Right. Now in semi-supervised what we have is a combination of supervised learning and unsupervised learning. The part is [44:07] part is that I have a small labelled data and we have a large unlabelled data. and we have a large unlabelled data. Right? So what I'll do here is in a very [44:22] simple algorithm. First of all I will use a small data. Let me show it I will use a small data. Let me show it with example. [44:35] labels. Right? So I have data about adults and I know about. >> So what I will do is first of all based upon these labels divide my unlabelled [44:47] data into that labeling. Right? So I will have people falling in the adult category. I will have people falling in the kids category. [45:01] supervised division done. That after doing that supervised division I will further divide it based upon the similarity and dissimilarities within those classifications within those divisions. Right? So supervised followed [45:15] by unsupervised approach that is where we call it a semi-supervised. So there is small little bit of data that is available to identify but bigger chunk is not identifiable. There is grouping is being [45:30] done. So here I can have babies, teens and twins. I have senior citizens, youth and twins. I have senior citizens, youth and adults. [45:42] Any typical example that you can think of in real world [45:59] Google photos if you remember or if you might have seen that you create up a folder if you're using some Google app account you create up a folder let's say account you create up a folder let's say my birthday put up certain pictures into [46:15] pictures from your machine and find out and put that into autocreated folder. >> Okay. UX full course, right? >> Have you seen Google creates some folders automatically for you? You have never created those but you labeled [46:29] certain images and because of that label it is creating them automatically. it is creating them automatically. JavaScript [46:41] wherein you are giving some label to small chunk not for everything other things are automatically labeled by because of that label that is semi-supervised Google photos is a very prominent example of this [47:10] of you might be interested to know about reinforcement learning a little too much but I'll start with the part that this is a concept that was actually started way back in 2006 78 somewhere around that part right it was actually dealt [47:27] with it at point of time and it went into the dumpy yards for a very long period of time but of late it has start picking up again in recent years if I say one one [47:43] and a half year it has taken up the valuation again on the top right so reinforcement learning is coming back to the market but it was into the slump for many years right [47:56] so What does reinforcement learning do? I'll give you small little idea to I'll give you small little idea to understand two things. I have a state. We call that as a state [48:12] and I have an actions. Two things. And we create a table of states and actions. Right? There is a table of states and actions. [48:26] action for let's say state one action one what is the outcome let's say I reach to state three for action three I reach out to state S4 whatever right so [48:38] there is a table that we generate into this this table is not generated by us how it is generated I'll talk about this but into that table it gets to know that [48:50] if it in it is in a particular state and takes a particular action It is going to reach out to a different state or may not reach out. It may reach remain in the same state as well. Possible, [49:04] right? Does not make an impact. But doing that action is that a action that doing that action is that a action that is rewardful for my goal to be achieved or is that a punishment or penalty for towards the goal? That means something [49:20] that is taking towards me towards the goal that is a reward activity. Something that takes me away from my goal that is a penalty for me. Right? So what it does is it tries to create up that uh [49:40] understanding or creates up a you know uh set of or sequence of uh states and whether it's a reward or whether it's a penalty to do for achieving a particular goal and that is what it is overall done [49:53] in a reinforcement learning we have states and actions called as Q star in reinforcement. We are not covering this topic in this course to be very precise setting your expectations right. But I would like to show a video to you [50:07] But I would like to show a video to you guys. [50:19] >> Okay team uh was the sound was audible? beautiful thing to learn. It's a very old video 2008 video but you will see [50:36] old video 2008 video but you will see some prominent names into this too. the most difficult aerobatic maneuvers flown by any computer controlled [50:51] flown by any computer controlled helicopter. hard problems that humans are very good at solving. Uh for instance, Garrett can pick up any helicopter, even ones he's never seen, and go fly amazing [51:04] aerobatics. So the question for us is always why can't computers do things software that can learn to go fly a helicopter uh the way that a human being engineering effort to build control systems like this. So the basic [51:20] technology used to develop the helicopter controller was a type of AI intelligence algorithm called apprenticeship learning. [51:33] human pilot fly the helicopter around for a while. And by watching a human pilot learn to fly, it then learns to fly by itself. And so what it does is it watch the person fly and then um it'll try to fly the same stunt maneuver by [51:47] itself and maybe try a few times until it sort of nails the maneuver. And what you're seeing is the end result of this um machine learning process called apprenticeship learning. So basically what the software does is [51:59] it uh acquires all of the measurements off of the instruments and then it puts filter that uh figures out where the helicopter is, which way it's facing, uh what its velocity is and so on. And then uh that information is fed into a [52:14] control system that decides based on where the helicopter is and where we controller actually computes new controls to send out to the helicopter every 20th of a second. What we do is we collect several demonstrations from our [52:27] expert pilot and then our algorithms process these demonstrations to figure out what would be the ideal version of let's say a flip or a roll or a loop etc. And then we use that as a specification for our control problem. [52:41] And this allows us to find trajectories that are better trajectories than the >> The helicopter doesn't want to fly. It always wants to just tip over and crash. So you always have to be maintaining the um the orientation of it. Whereas an [52:54] airplane, if you let go of the sticks, it would more or less fly fairly straight. I've never seen anything like this done. The only autonomous helicopters I've seen are just they're hovering way [53:06] seen are just they're hovering way points and doing quite basic maneuvers. well, in order for us to trust helicopters and these sort of mission critical applications is important that we have very robust, very reliable [53:19] helicop helicopter controllers that um can fly maybe as well as the very best human pilots in the world can. And the work you saw today I think um took a work you saw today I think um took a large step towards achieving that. [53:39] machine learning. Now I'll say that he's considered to be a father of machine learning. Andrew NG one of the very prominent name he was in the field of machine learning. Beautiful things written by him if you ever get a chance [53:53] to little bit complex in terms of language but yes uh beautiful by Andrew NG. If you can read his material, it's available all over the material, it's available all over the internet [54:10] is a typical example of reinforcement learning where in a helicopter was looking at the maneuvers done by another pilot and start learning those things [54:22] and because once it has learned those things it has created you know a sense of understanding that if I have to do a flip or I have to do a rotation then what actions what sequence of actions I need to take it [54:37] right then came deep learning into the picture that demeaned the reinforcement picture that demeaned the reinforcement learning concept. But then came in 2025. [55:10] model which was primarily based on reinforcement learning. There is a less of deep learning concept more of the reinforcement learning concept. That became again a discussion in our fraternity that is reinforcement [55:23] learning the go-to thing. And essentially if you ask my personal opinion yes it is a go-to thing but it's slightly complicated uh not easy to you slightly complicated uh not easy to you know implement not easy to compute uh we [55:37] have certain fixed algorithms into it which are very very complex you on reinforcement learning that's another topic might take 40 45 hours [55:49] reinforcement learning itself it's a very deep concept right so maybe we will learning some other day but in this course we're not covering reinforcement course we're not covering reinforcement learning. Are we good? [56:05] raw data from the environment. It learns uh what algorithm to choose and then try to find out the reward and penalties and get the output generated. [56:24] it shows is YouTube. Uh I tend to slightly disagree on that because YouTube does use reinforcement learning to some extent but more or less it is based upon deep learning concepts of recommendation systems are not exactly [56:38] recommendation systems are not exactly reinforcement learning only. self-driving cars not reinforcement learning search engine recommendations [56:53] autocorrect tools game players can play with the bots most of them are implemented through deep learning in current scenario yes they are a concept that you can implement through reinforcement learning as well [57:07] learning is still in progress I will not say that it has been achieved but same concept that you see on my screen right now they achieved through deep learning already. We have already achieved all those things through deep learning with [57:20] reinforcement learning is still in work in progress. I will say that coming to the last end towards the end of this particular uh presentation. I'm going to talk about some Python packages or libraries which are important for me [57:35] during this course. Uh some names are displayed on this screen, some names may displayed on this screen, some names may not be displayed up. Right? So very important these three libraries numpy, pandas and mattplot lip. I have already [57:47] requested that each one you should be aware about at least numpy and pandas. Matt plot li. Yes. Okay. I can think of not be aware and I can think of that. [58:00] Okay. You can think of EDA section is avoided out. I will try to avoid if required the EDA part so that we can save time onto EDA part. And if you want me to do EDA, I'll do that too. No problem. [58:13] Then this comes two libraries which are important. Uh one is sci another one is not expecting you to know everything about there. But maybe if you are aware [58:25] well and good if not I'll take care of that. Apart from that I'll also use tax that. Apart from that I'll also use tax model that will come in picture right small little packages. So as and [58:41] talk about them but majorly these three libraries sci-fi circuit learn and stat libraries sci-fi circuit learn and stat model. Good. model because you might have used that in uh mathematics course. If you have [58:57] gone through ANOVA K square test you might have used stats model in sci before scitland not many one of you would have scitland not many one of you would have used it. [59:17] learning refers to the ability to learn from data and replicate human behavior. just replicate human behavior because not every time a human can activity is associated with machine learning that's more or less into the deep learning [59:32] concept. AI includes machine learning, deep learning and each with unique capability of simulating intelligence. Good. machine learning to enhance customer experience in an e-commerce company. [59:47] experience in an e-commerce company. Again very basic thing elimination. Yeah, it's C. [01:00:13] multiple layers of complex pattern recognition. to cover up in this particular sheet for us. When I'll talk about what is supervised learning, what are different categories of supervised learning. TF2 [01:00:28] classification and regression and where is supervised learning being used in the current scenario and then we'll talk about the names I'll only talk about the names of some supervised learning algorithms I will not talk in detail [01:00:41] about those algorithms right now we'll discuss them in detail one by one good [01:00:59] and we are going to start up with some more theoretical things confirmation more theoretical things confirmation mangjanat muda or mudul sorry [01:01:13] with the supervised learning part and I'll start introducing you what is supervised learning we have already seen what is supervised learning given you small little idea about what is supervised learning so it's a kind of [01:01:26] supervised learning so it's a kind of approach. I will say that [01:01:41] maybe to this one that will be a little bit more better. right it's a kind of approach or it's a branch of machine learning wherein I am [01:01:56] trying to make my machine right or where my algorithms are going to learn from a labeled data right I will have inputs I will have the outputs [01:02:08] and I'm going to put those inputs and outputs to a algorithm the algorithm is going to learn from that data and generate my model right [01:02:23] supervised learning. So it's a type of so supervised learning [01:02:48] these are predefined methods that we have right we learn these algorithms one have right we learn these algorithms one by one learns from labeled data [01:03:11] input output pairs [01:03:24] In supervised learning what we do is in supervised learning we train the algorithm. We train the algorithm [01:03:45] on a data set means the columns that contain the inputs. [01:04:07] goal is I can put up the goal here as well. The goal is to map well. The goal is to map the relationships [01:04:24] have or essentially you can say the model right algorithm is to map the model right algorithm is to map the relationship [01:04:47] and the output labels and this relationship identified. So the relationship identified [01:05:28] on unseen data. So something that is not there right typically what is supervised learning that we have as a part of introduction I [01:05:40] can say that let's talk about the categories of supervised learning categories of supervised learning majorly there are two categories [01:06:08] based upon the nature of the target or the column or output whatever you want to say it as but [01:06:20] target variable we what kind of target variable nature we're talking about right. So there are two types of problems that we solve. One is called as a regression and the second [01:06:33] is called as a regression and the second type is called as a classification. regression and what is classification? Let's understand that good. [01:06:45] So for that purpose we should know what is a continuous value and what is a what is a continent and what is categorical? [01:07:02] what algorithm that you're going to use to solve a particular problem. So you should be very much clear about thought process about what is continuous and what is not continuous or what is categorical. [01:07:23] So let's try to think about a data for a moment right [01:07:37] categorical that we that we countable uh we can't count continuous uh categories So okay if I talk about the data right if we [01:07:52] talk about the real world data in data if I talk about data data I can divide into two sections either the data will be in a number either the data will be in a number format or it will be in a text format [01:08:06] right usually right either I'll have numbers or I'll have text agree to that numbers or I'll have text agree to that yes or no great now when you talk Number the numbers are divided into two categories, [01:08:25] right? Numbers have two categories. One we call as a continuous number and second one we call as a discrete number. [01:08:39] classified into categorical miniature only. Good. So that is the basic uh ideology behind the segregation of data. But what [01:08:53] is continuous? Right? So continuous is that data. Please understand it. Continuous are those numbers where there is a possibility of a number or any value between any two consecutive values. [01:09:08] For example, let's say think about a school, right? Let's think about a school as a common example, right? If I talk about a school and let's say I have some number of children in my school. Good. [01:09:23] Now there is a child of age three. There's other child of age four. Right? very generic question. I'm talking about their ages right now. Right? [01:09:36] So there is a child of age three in my school. There's a child of age four in my school. Is there a possibility that I have another child in my school who is between three and four? [01:09:51] Is there a possibility? Right? Or what is the possible numbers that I can have in between three and four in terms of ages? How many numbers four in terms of ages? How many numbers are possible? [01:10:08] Not just 3.5. That is just one example Simon 12 9 essentially what I'm trying to ask you is what is the possibilities of numbers [01:10:21] in between three and four in if you think about ages my I can have people practically possible only 12 [01:10:37] there is a child of age four. I can have a child whose age is 3.01. that I have a child with 001 or 00001 [01:10:53] or 0000001. Essentially, if I talk about there's a possibility of infinite values in between three and four, I can go to your their you know time of birth. uh mean seconds, milliseconds, [01:11:09] nanoconds, sptoconds, whichever level we can want to go up to. Essentially there is a I'm not saying that there will be a value not saying that I'm saying that there's a possibility of having a value correct [01:11:35] particular feature any particular column of the data if there is a possibility of of the data if there is a possibility of values there is a possibility probability of infinite values. I will say that is a [01:11:49] infinite values. I will say that is a continuous number. right when you measure certain things you say that these are continuous [01:12:01] you say that these are continuous numbers. Usually example to talk about continuous numbers. Let's talk about weight. [01:12:20] close to 72 kg or there will be some point to be 7 if I go to very very high precision possibility of 72.00001 as well. Do we agree? [01:12:42] things are measured and there exist the possibility of having infinite values between any two consecutive values I will say that as a continuous quantity. Good. Then comes the discrete quantities. Right? In numerical I have [01:12:58] talked about two things. One is numeric quant and second one I talked about discrete numbers. What are discrete numbers? Discrete numbers are again numeric quantities, [01:13:12] right? But they have a finite value. Finite and fixed value. Let's talk about an example, right? For example, let's say you roll a [01:13:25] dice. When you roll a dice, what you will get? You have six choices. Either will get? You have six choices. Either you will get 1 2 3 4 5 or six. Is there any other possibility? Is there a possibility that I can get a [01:13:40] Is there a possibility that I can get a 1.2 or 2.7 or 3.4? Is there any possibility of having a value between 1 and two, two and three, three and four, four or five? There's no possibility, right? I'm still getting the numbers, [01:13:52] right? I'm still getting the numbers. But these are discrete numbers. Discrete numbers means that there is no possibility of having a value in between any two values. taking the school example [01:14:05] right if I say that my school has 100 childrens or I will have 101 children I cannot have 100.5 children is it possible can I have a value in between [01:14:20] no right so things which are counted usually counted right countable things usually counted right countable things are usually called as discrete numbers [01:14:34] Countable things, countable numbers are discrete values. Good. Remember, it has to be discrete means these are finite. It can be a finite set of values. It can be an infinite set of values as well. I can have long numbers, long list of [01:14:47] things. But in between two consecutive values, there is no other value possible. Good. That is called as a discrete number. Are we clear? [01:15:03] So when I say categorical categorical essentially means that I am representing a category that means I have fixed values right which are not numericals usually not numerical they can be numerical as well [01:15:17] right so let's say for example days of the week I can have Monday Tuesday Wednesday up to Sunday good there is nothing possible in between right I have fixed finite set of values which are in text form I will say them [01:15:32] as categorical at times listen to that very carefully at times I will represent these categorical values in form of these categorical values in form of numbers [01:15:46] but that's not a different gender we have these three genders good now I might represent the data in the form of MFTt male female and transgender or I might also represent them as 0 1 and Both of them are categorical right now. [01:16:02] They are representing a category. Make sense? So it depends upon the nature of sense? So it depends upon the nature of the data to decide whether I may have numbers but they might be representing a category. [01:16:20] you give me an example where there is a text and not representing a category? text and not representing a category? a real word thing. [01:16:35] suppose I collect the list of names of the students that I have ever taught the the students that I have ever taught the names of the people [01:16:47] are different and unique for example the number is going to be get more than 15 to 20,000 more than that people have been gone under my bed right suppose I have 10,000 different unique names does that mean these are [01:17:03] names are a category. These are text, right? So, not always a text is going to right? So, not always a text is going to be a category. Remember? [01:17:16] Names is not a category, is it? It is not a finite combinations of value. That means I have 10 names, 20 [01:17:31] names and all names will fall in that category itself. No, that was the last that that I've shown up. Any more questions on on categorical [01:17:46] and numerical on continuous [01:18:08] So what we decide in regression is when my target variable when the target my target variable when the target variable [01:18:22] So if my target variable is of continuous nature right the prediction continuous nature right the prediction task [01:18:36] variable which is of continuous nature I will say that as a regression problem. Example could be prediction of house price. [01:18:54] We'll uh work on this data, house price data, right? Uh let's say any random numbers, any random picking up things. [01:19:23] going to be so it can be 32 32° F, it can be 42° F. It can be 41 41.001. Could be anything. Right? I can have any continuous value [01:19:35] coming in between for temperature or degrees centiggrade whatever you want to say that as good. So that is regression task [01:19:52] prediction of a car price. Yes, you can say that I can talk about classification team level [01:20:11] Please remember team categories can be represented as text they can be represented as numbers. We need to think that what we are trying to predict is that a category or not. We need to decide the nature of the data. [01:20:26] decide the nature of the data. Good. categorical, the prediction task is classification. start with the regression first and then we'll delve into the classification. [01:20:47] >> At least mathematically it would not be possible. [01:21:10] >> Great. So we have seen what is target variable is continuous means that when we will get a data right that data is going to be in the form of a data right we will have a data in the columner form right one of the column [01:21:24] columner form right one of the column will be decided as the target means the column that I wish to predict I wish to predict a category or I wish to predict the continuous data so We need to take up a decision or call [01:21:38] what is the nature of values in my target column to show if it is a target column to show if it is a continuous number right then I will think of regression if it is a category into that I will think of a [01:21:50] into that I will think of a classification category right it's a continuous number then I'll use a regression problem good I hope so that makes it clear for everyone [01:22:15] too much. I have a picture for you guys. Just show it. [01:22:55] accordingly either hot or cold based upon temperature value again temperature. What you're telling me is the nature of temperature, right? Is it hot or is it cold? As Fon has. [01:23:15] applications. I will just only talk about the names of I will just only talk about the names of the industry [01:23:35] where you might have observed. Let me talk about example number one. HR Do you think that there is a role of machine learning in HR operations? [01:23:53] ATS. Many of you would have observed ATS. In the field of finance essentially there is no other field no field where machine learning is not present. Emails whether email is a spam or not a spam [01:24:09] whether email is a spam or not a spam manufacturing. [01:24:29] it is a high tide or a low tide that can decide which way I want to take up my cruise or the ship any kind of incident management if there is a prediction of maritime icebergs I [01:24:42] can avoid titanics Agreed weather forecast can be a part of Agreed weather forecast can be a part of it. classification but usually through a picture we do not [01:24:55] do it through machine learning pathy we do it through a deep learning concept but it's a classification fraud detection [01:25:09] stock market price prediction regression problem the finance category some examples I'm not saying this is the entire thing in [01:25:21] which are more than this. There can be lot of industries where I have machine lot of industries where I have machine learning algorithm available. [01:25:33] spam is classification. I have two categories of emails. I have two categories of emails. It is a classification. Right? [01:25:50] So these are typical things. Last but not the least, I am just putting up some not the least, I am just putting up some commonly used algorithm names. [01:26:33] one that I'm going to start with. We will have logistic regression. [01:26:45] We can have naive base. We can have uh We can have uh K nearest neighbors [01:26:59] usually known as KN&N. We can have decision trees. [01:27:28] uh you know I would say that these are the names of the base algorithms or the kind of algorithms which are commonly used right and we will walk around with [01:27:40] each of these algorithms their intricacies their mathematics one by one. It is going to take almost like entire course time. But apart from this, [01:27:52] majority of the time will be spent on this. But apart from this, we will also learn how do we create algorithms of our own. Right? For example, we'll learn how to create algorithms like you might have seen algorithms uh in supervised [01:28:07] seen algorithms uh in supervised learning. I will talk about let's say supervised learning algorithms. You can think of a gradient boosting machine. [01:28:21] extreme XG boost model. You might also want to know about let's You might also want to know about let's say [01:28:33] common names that you might have seen over the internet or some but these over the internet or some but these models are actually not individualistic. models are actually not individualistic. they use some of these basic models [01:28:47] right. So ident understanding these first seven models is really important first seven models is really important right. If you understand these going through with advanced models like GBM 6 boost boost is easy right [01:29:02] because this is just a you know kind of arrangement or kind of on assembling that we do with the or arrangement of these models that I do up in order to [01:29:14] create these models. nothing new into this right so this these are not some separate entities they have a separate thing of their own these are just the combination that I have arranged up in a different manner [01:29:27] of these basic ones so understanding basic one is more important then you'll when you club them together what you create up is advanced problems [01:29:50] use case linear regression I can have common use linear regression I can have common use case let's say prediction of house price [01:30:05] logistic regression I can say any kind of classific application where I have I have yes or no choice I have good or bad choice buy will not buy choice like [01:30:20] bad choice buy will not buy choice like let's say for example customer churn whether a person will buy or not pay I can use for let's say spam detection [01:30:43] common use of KNN is healthcare. Why healthcare? Because uh this is an algorithm that is based upon the nearness or how closely the values are [01:30:55] right. the what we impact what we think of is that if there is X he's affected by one particular disease then potentially a person close to X will be potentially have higher chances or higher probabilities of getting affected [01:31:10] that is basically ideology behind KN&X we'll discuss that in detail what is that decision trees anywhere I have a rule-based decision-m process I am taking a decision but that decision [01:31:23] is based upon certain set of finite rules So rulebased decision-m process I will use decision trees. You are not going to create the rules. Rules will be generated by the machine. [01:31:36] But we want to do that bas on the basis of rules credit scoring. then I have to do credit scoring or some kind of things that is [01:31:51] again rule based kind of thing but with multiple numbers of things to be taken up together support vector machine uh we generally support vector machine uh we generally use it in social media monitoring [01:32:09] of the data how good or bad quality data that I have sensible [01:32:25] I've put down here, we will walk around with all of them. some more algorithms. If I talk about in totality, you will learn about somewhere [01:32:37] close to maybe more. I exactly do not know the number. I might introduce you some other algorithms which are not part of a algorithms which are not part of a standard curriculum. [01:32:54] the algorithms or how to modify the existing algorithms. In this course, I existing algorithms. In this course, I will talk about algorithms. Okay. [01:33:11] Okay. Shall we begin? [01:33:31] learning, the regression techniques and we'll start our agenda. Start with the agenda. What is in store for you in this particular file? This file is going to be continued for next two or three sessions. I'm pretty much sure it might [01:33:45] sessions. I'm pretty much sure it might take a little bit more longer than that. regressions. We'll not again we start building up what is regression and everything not required types of regression. And the [01:34:01] first type of regression that I'd like to talk about within that I will talk about simple linear regression [01:34:23] scikit learn that is train test fl over here we then we'll talk about multiple linear regression [01:34:43] Within that I'll try to build up a concept of overfitting [01:35:04] very common thing bias variance tradeoff. statistics team. Uh we will deal with lot of statistics and [01:35:16] mathematics. So there is a small little preparatory course on basics of fundamentals of mathematics and statistics. Right? I hope so you guys have gone through with that basic understanding right I need to know you [01:35:28] should know what is normal data what is not normal data these kind of things [01:35:48] it's a big agenda team within that I will talk about polomial regression [01:36:02] done. Then we'll talk about model evaluation techniques, model evaluation and validation. [01:36:14] We'll talk about cross validation techniques. techniques in there basically two afold and [01:36:32] matrix essentially these performance matrix about it we would have the explanation of these right before we come up to this point right I would have to use these performance matrix [01:36:48] initially itself in order to make you understand what is linear regression. So understand what is linear regression. So performance matrix for regression [01:37:08] there I will talk about number one mean squared error terms we'll talk about root mean square error [01:37:28] Then we'll talk about mean absolute error commonly called as M A and we'll talk about R² [01:37:47] very important term in terms of regression. R² we call as R2 regression. R² we call as R2 usually called as R2 [01:38:07] we will talk about some regularization strategies, the regularization techniques. Long agenda team [01:38:23] I will have two techniques that I'd like to talk about. One is called as Blasco to talk about. One is called as Blasco regression terms again you will see the usefulness of these things uh at the later stages [01:38:42] when you will see regularization being used lasso or L1 regularization and L2 I'll introduce you what is L1 and what is L2 later on Then this part is not [01:38:55] typically for the linear regression or the regression problem that I'm going to solve up but this is going to build up our concept. This is a model optimization technique I can say that and uh which is called as hyperparameter [01:39:09] tuning which is actually applicable everywhere. It is applicable in regression. It is applicable in classification as well or in other types of modeling approach. hyperparameter tuning. I will talk about [01:39:23] hyperparameter tuning. I will talk about grid search CV grid search CV model. [01:39:41] and we will look at circuit learn pipeline skarn pipelines. [01:39:55] uh this part not course but this particular topic which is supervised learning regression now I would want team to go through with whatever agenda that I have written down right just go through it once [01:40:11] if you feel that in terms of regression some of you are already about machine learning or have used machine learning in the past so I would love to have some more inputs. If you think that there is any particular topic which is missed out [01:40:25] any particular topic which is missed out then let me know. [01:41:29] like to bring into the picture or onto the table? [01:42:26] regressions, this is where I have told you that I'll start off the West I have not talked about what is regression we have discussed that so predicting of a continuous data is regression how we are going to predict it up that's a separate [01:42:38] thing right where do we use it almost everywhere right I can use it in oil gas marketing retail healthare real estate anywhere I start from that point so a regression can be classified into two categories [01:43:25] Number one we call it as a linear regression and the second one is called as nonlinear regression. [01:43:57] linear regression. The objective that in linear regressions [01:44:13] not make sense as of now to many people. The straight line relationship between the dependent variable. When I say dependent that means the target variable dependent variable [01:44:27] variable or that you can say target and one or more [01:44:52] talking about the features independent variables that means features [01:45:07] I can have single feature or I can have multiple features as well. Good. [01:45:20] What does nonlineous regression do? It is also going to use uh dependent variable and independent variable. But in a typical more complex shape, it will use a little more curved shape or curved lines or complex shape [01:45:37] structure not a straight line. Now very important to understand what is that straight line relationship and how does it make an impact. We'll discuss that. it make an impact. We'll discuss that. But let me put up nonlinear regression. [01:46:33] with EDA and might have studied about regression plots and reg plot and zon or might have seen that in joint plot a straight line that is putting across the relationship or defining the relation between [01:46:51] the two variables, right? You might have seen those things. [01:47:11] regression. That's the first category that we need to deal with. Let's start that we need to deal with. Let's start with linear regression. [01:47:31] will just copy paste those. Would that be okay? 12 minutes left out for the today's session. Not looking forward to build session. Not looking forward to build the concept first. Right? [01:47:51] I want to build up the concept of this that might be useful for you. So linear regression as the name suggests it tries to identify with a that is used to predict a continuous variable right a continuous target and [01:48:05] we will try to do that prediction using a straight line equation very simple a straight line equation very simple logic that means [01:48:21] right a simple data I'm talking about let's say one independent variable and this is for the ease of understanding right I have a data that contains two columns a column X and a column Y [01:48:37] I have named them X and Y because there is a certain reason behind it later on when we start with scikit learn you will understand why X and Y where X is my independent column or my feature or my input and Y is my target. So my job is [01:48:55] that if someone gives me a this is a given information to me right I have given information to me right I have let's say 100 rows of the data where for a particular value of x I know the value of y this is given to me now there can [01:49:09] be 101 value where I do not know what is the value of y and I want to predict what is the value of y going to be for that 101. one value of y going to be for that 101. one at the top [01:49:31] what I can do here is >> I will take those x and y and let me just plot a simple scatter plot. So I'll take x on x-axis and target y on yaxis [01:49:43] take x on x-axis and target y on yaxis and I can plot a scatter plot of this. This is >> right. I will have certain dots [01:49:58] like for all the randomness in the word I have put down the dots. logic right? For certain values of X I have certain values of Y accordingly I [01:50:10] have certain values of Y accordingly I plotted up that simple scatter plot. that if I have to establish a relationship between y and x what I want [01:50:27] to do here is I want to get the value of y. y. Now by a function of x that means there is some explanation that I can give about y using the value of x. Does that [01:50:43] about y using the value of x. Does that make sense? going to use to explain why in linear regression that function is a straight [01:50:59] line in linear regression that function is a straight line. So if I just try to is a straight line. So if I just try to draw a straight line for you here, let us suppose this straight line represents that relation. [01:51:14] >> This is the line. Now this is a straight line that is showing up the relationship line that is showing up the relationship between X and Y. Agreed. >> JavaScript and security uh sheet JavaScript and UIUX. [01:51:42] makes an angle here. >> Let's say this angle is theta >> Let's say this angle is theta with respect to the x-axis or my input variable or independent variable. Good. >> It makes an angle. [01:51:57] So if I have to geometrically represent the equation of this line, >> what is it? >> I can represent that equation as y >> I can represent that equation as y >> m x + [01:52:12] seen that equation before team maybe in your schooling days. terms that are coming up. one is called as M and there is a C because we know [01:52:27] there are certain values of Y and certain values of X which are given to us. >> We already have those two terms. What I >> We already have those two terms. What I would now need is that line this line is [01:52:41] having so I if I can find the value of M and C right then I will have that line equation. [01:52:55] So we should know what is M and what is C. So this word M is called as the slope C. So this word M is called as the slope of the line [01:53:13] right now. I will later on change these terms and I'll use the terms which are used in regression. Good. I'll tell you what are those terms. So if it is slope and intercept can you tell me what is this? How is the slope can be measured? [01:53:29] this? How is the slope can be measured? >> The slope is always given as tan theta >> The slope is always given as tan theta of an valley. What is the slope of this line? It's a tan theta there. So theta is the angle that it makes with this [01:53:42] axis. So the slope of this line with respect to x is tan theta of this angle or is the tan value of this angle. Can we get this tan theta value anyhow? [01:53:54] we get this tan theta value anyhow? Anybody? Let's say in this equation in this scenario scenario very easy it is [01:54:13] that line let's say suppose I took up this point and this point draw horizontal line like this vertical line draw horizontal line this this angle is also going to be theta correct [01:54:34] opposite side by base perpendicular upon base. So I can measure that distance. I can measure this distance [01:54:49] and I can get the tan theta or you can say that it is y2 minus y1 upon x2 - x1. Do we agree? [01:55:05] equation was C. C is called as the intercept or intercept is the point at which the line cuts the y-axis. So my point is [01:55:17] the line cuts the y-axis. So my point is here. So the distance from x-axis to this height is c. The point on yaxis where the line cuts The point on yaxis where the line cuts the y-axis. Are we good? [01:55:36] Or essentially if you put into x value as zero you will have y is equal to c. as zero you will have y is equal to c. Correct. So when my xaxis becomes zero y becomes equal to c or intercept or essentially in other words it's the [01:55:51] essentially in other words it's the value at which the line cuts the y-axis. [01:56:03] Does all this made any sense to anyone? Whatever I explained [01:56:15] is about the supervised learning regression techniques and we have types and the simple linear regression multiple linear regression and so on going on with nonlinear model evaluation and so on that was the agenda that I [01:56:30] giving the different types of regression. What are the different linear regression, another one is a nonlinear regression. Right? So when we independent variable and dependent variable uh through a straight line [01:56:45] equation, we say that as a linear regression. If it is nonlinear relation or I can say that it's curved relation or any complex shape relationship, I or any complex shape relationship, I will say that as a nonlinear regression, [01:57:03] showcase an example of a regression how do what exactly is the objective that we try to fulfill. So I'll start back again from that same point. All right [01:57:18] perspective to it. Okay. very simple data uh I love fruits so I'll take some fruits example suppose [01:57:34] you have a data that is given to you a simple data I'm taking up where you have simple data I'm taking up where you have an information about the quantity of the fruits being bought and the price being paid [01:57:48] right there only two information a quantity and a price. bought a quantity three, you paid a price seven. [01:58:02] On some other day you bought quantity two, you paid a price eight. Some other day you quantity three, you paid up a price 9. Another day you bought up quantity four, you paid up a price 10. Then some for five you paid up let's say [01:58:16] seven. Or let's say for six he paid up 12 or Or let's say for six he paid up 12 or could be something like that. Good. [01:58:32] the task that you have to complete is that what is your objective? Your objective is what if I buy a quantity seven? How much money would I be paying [01:58:44] seven? How much money would I be paying up? Are we good? perspective. Let us now try to formulate that data Let us now try to formulate that data into terms of a graph. I have two [01:58:58] values. One is a quantity and other one is the price. So I'm going to plot up a simple graph, a very simple scatter plot, [01:59:11] yaxxis on x-axis and I'll take price on y-axis. an example with smaller chunk of data to make you understand the concept. The [01:59:24] real picture will have lot of amount of data. So that picture will look slightly data. So that picture will look slightly different. Good. when x is three, let me put up the lines first. [01:59:41] So let's think of this is one, this is two, this is three, four, five, 6 or maybe seven. And then I can think of yeah maybe 1 2 3 4 5 6 7 8 [02:00:00] 10 in my team. This is not to the scale. So please allow me with that part. I am not very much expert in that. I can plot up want but that will not make any sense. Okay, [02:00:16] let's try to plot up certain points. So when the first point when x or quantity was three the price was seven. So I can think of 1 2 3 4 5 6 7. So here good [02:00:29] when it was two it was eight. For two it is eight. Somewhere here another dot comes over there. Then for three again I have nine I have uh nine [02:00:42] three again I have nine I have uh nine over there. Good. Then four for 10 I may have a point over there somewhere around. Then five for seven [02:00:55] And for six I have 12 maybe somewhere here on the top. Good. So these are the points as per my data. Is that okay? [02:01:17] looking at I'm going to remove this picture not required anymore we have got picture not required anymore we have got the points [02:01:29] objective is that I want to tell the price I want to tell the price if I knows some quantity. So I need a function in the terms of quantity. [02:01:41] Mathematically it has to be something with respect to quantity with respect to quantity this [02:01:53] I have. I only know what quantity I'm going to buy up. So I have known things. On the basis of known things, I want to find out an known things, I want to find out an unknown thing. That's my objective. [02:02:07] unknown thing. That's my objective. is that I will try to establish this relation in the form of a linear equation. in the form of a linear equation. When I say linear equation, essentially it [02:02:20] means a equation of a line. Good. So I can assume as of now I am assuming I'm not telling why I'm taking that line. I will explain how will I come to that will explain how will I come to that conclusion as well. [02:02:34] Good. Let us assume that a particular line let's say this line depicts the relation between the depicts the relation between the quantity and price in terms I am trying [02:02:48] quantity and price in terms I am trying to say is that if you take price is to say is that if you take price is equal to a constant multiplied by the quantity plus a constant C. [02:03:01] plus a constant C. Good. this line. Try to reset. Your objective is just to [02:03:17] find that particular line. >> And that would be your linear regression model. First algorithm linear regression. If I can find out a way that regression. If I can find out a way that is this line that I want to take up. [02:03:31] Because if you think about lines in this plane in this graph, >> there are infinite line possibilities that you can I can have another line like this or a line like this or a line like this or a line like this. There are [02:03:46] infinite possibilities of line. Now out of all these infinite lines, which line do I have to choose? That is the most important part, isn't [02:03:58] That is the most important part, isn't it? I will think that this is my best possible solution. So I need to make a [02:04:10] decision that which one of these lines is my best possible solution. P and you need to provide a best possible solution S complete. [02:04:27] What would be the your perspective towards the best possible solution? >> I'm leaving now to take my update. [02:04:43] solutions to that problem P. Then solutions S1, S2, S3, SN, right? Then out of all those solutions, >> I will choose a solution that offers me [02:04:56] >> Do we agree? >> Both names are same kind of. >> So what we expect is that each of those solution is going to give me some kind [02:05:09] of error. >> Right? It might be 1% error, 10% error, 20% error. But out of all the possible solutions, I will look forward towards a solution where the chance of error or the amount of error is going to be [02:05:25] minimal, whichever it may be. >> Agreed. >> Agreed. >> It's going tomorrow, >> right? So your objective here is to find a line. Listen in linear regression I am [02:05:40] going to find out a straight line that has minimum or that gives me minimum amount of error. The question arises how will you measure the error make sense [02:05:53] over there >> just out build up that the line that I have I have like I have thought of a random [02:06:05] >> I have not taken this is a randomly created line >> I should have sent me this titles all title and that is 23 hours only >> good let us now since I have already selected that line. Can I find out? Very [02:06:20] important things? >> The first thing is the slope of this line. >> No. When she confirms >> thea and the second thing is the [02:06:32] intercept. >> Is that possible to find out? >> Is that possible to find out? >> That's it. >> Oh, no. No. If it is not possible let's say [02:06:47] open my laptop >> cannot find it. I will start with a random value of slope. I have chosen a random slope right and a random intercept. I will start with a random slope value [02:07:04] and a random intercept value. Right? Because I am choosing a random line. It means I have chosen a random slope and I've chosen a random intercept for it and I've randomly drawn a line >> because since I've already chosen a [02:07:18] slope and intercept that essentially tells me >> that I have a line and that has a equation equation >> y is equal to m which is my slope x [02:07:32] >> y is equal to m which is my slope x which is my input plus c which is my intercept. Good. Now remember I have I currently Good. Now remember I have I currently know the value of M and C. Why? Because [02:07:47] I have randomly chosen that value. But what happens? >> So now I know this line. Do we agree? Yes or no? [02:08:08] is two. For example, I can put up any random value for X, I will get a value random value for X, I will get a value of Y. So three. So for when X is 1, Y is 3 into 2. For X1, Y5 >> would be a point randomly chosen, right? [02:08:25] >> Oh man. So I can find out two points and connect those two points and create my >> Sometimes I my brain works like good >> but I still do not know whether that is my perfect line or not. Agreed with Satika she's on leave but I'm sharing it [02:08:39] Satika she's on leave but I'm sharing it with also and also with also and also now how do I check the error [02:08:51] and yeah so what we are doing over there is I am going to make predictions based is I am going to make predictions based upon this equation of line >> security engineer >> what are I'm trying to tell it that this [02:09:05] >> what are I'm trying to tell it that this equation of line is a representation of the relationship between my target variable Y and input variable X. [02:09:17] variable Y and input variable X. This is what we are saying yes or no. [02:09:29] we can differentiate well and in terms of the architecture or the nomomenclature that we follow usually I will represent the results of my [02:09:41] predictions with a hat symbol. So I will say my prediction is yhat is equal to mx + c [02:09:54] mx + c and for the actual value of x for actual value of x whatever is my actual given data for y I will take that as original data for y I will take that as original value. So without hat. So why without an [02:10:07] hat? Let's say for example we had the first data point here when this one point right let me just take up a line two [02:10:23] when x was two right y was this [02:10:36] that basis we have got this data point plotted out correct. [02:10:48] for the same value of x when x is equal to my predicted value yhat is equal to if you look at that very closely it's this point on that line [02:11:03] this point on that line correct Okay. [02:11:16] So let us assume that value is six. This is an assumption to just an assumption. I'm not saying that this is not the not to the scale and I'm not actually solving. This is just an assumption and I'm assuming the value. Good. So what I [02:11:28] can say here is that I putting that with a red dot. See when for this particular so brown dot that you see over there this is your actual value and the red dot is your [02:11:43] actual value and the red dot is your predicted value. Can I say that [02:12:01] >> point. Yeah. >> Tell him just take the responsibility. Give the case to someone >> after recorded. [02:12:13] >> Okay. So if you look at what did I make the error as my error can be now given as the difference between the actual as the difference between the actual value and the predicted value. [02:12:28] Can I say this is my difference over there? This is my error, isn't it? So does Yeah. This is your error. This is your error over there. This is your error over here. This is your error over here. This is your error over here. Now [02:12:41] lines are that should be vertical between parallel with the y-axis. Please between parallel with the y-axis. Please pardon my drawing. [02:13:01] value. What is that amount of error? Amount of error. I can quantify that by Amount of error. I can quantify that by subtracting my actual value with the predicted that is your quantified value for the [02:13:16] that is your quantified value for the error. eight predicted value is six. So my error is plus two over there. [02:13:29] Let's assume that is + three. This is assumption. Let's say this is also + three. >> Let's assume this is + three. Again >> Let's assume this is + three. Again assume this is minus 7. [02:13:48] >> This is our assumptions. All assumptions good >> you might say that it does not look like that. Great. Now if I ask you in a very that. Great. Now if I ask you in a very simple manner correct [02:14:03] let's put up a counter variable I yhat of I Y of I minus Yhat of I and what we are taking is the summation of that. Do we agree? [02:14:19] >> Great. And if I ask you the average error, you will divide it by the number of elements. >> So I is equal to 1 to N. [02:14:40] solve this part, you will get an average error as zero. doing a perfect job. Zero means 100% [02:14:54] correct, isn't it? [02:15:11] >> A zero error does not mean 100% correctness. >> in my situation >> what we see is mathematically the value [02:15:28] >> what we see is mathematically the value is zero >> there should be some error zero does not that's a separate thing [02:15:41] will get zero errors it is possible to create such things. But point is not that as of now. My point is >> the calculation of error are we that we are doing as of now. The quantification of [02:15:55] error that we are doing because the mathematical calculation or the average calculation of the error is telling me that there is no error or zero. Right? But actually when I look at this information I see that there is lot of [02:16:10] errors into this. And why is that zero coming up is because of the negative and positive nature of the error terms. I have certain errors which are negative. I have certain errors which are positive. [02:16:25] positive. So how can we control this? [02:16:38] nature. security >> and certain errors which are of positive nature. Yeah, more or less we can square the value. Either I will calculate my the value. Either I will calculate my error as an absolute term [02:16:56] or I have a second choice where I can take a square of that term and then take take a square of that term and then take a square root of it. [02:17:08] terms you can convert any negative value to a positive term. So there are two measures by which I can put down put it the put the error on right. Number one [02:17:21] the put the error on right. Number one is called as the absolute error. negativeness or positiveness of the differences or rather I will [02:17:36] of the differences or rather I will modify this equation as sigma i = 1 to n values whatever the difference comes out I'll take the absolute difference [02:17:51] absolute difference means if result is negative or positive I will still take it as positive term Now can someone quickly tell me what will be my absolute error in this average absolute error? [02:18:05] average absolute error? Good. No problems. So point is that if I take the sum of the absolute errors and divide it by or take the average sum of the absolute errors and right we take the absolute error average. I will call [02:18:22] the absolute error average. I will call this term as mean of the absolute error [02:18:35] or in short we call it as m ae. Did we get hold of it till now? Do we understand what is me ae for now? Is that okay? [02:18:54] I have created the concept of one of the performance metric that we look at in performance metric that we look at in regression model which is M AE and please remember I am going to transform this to our ultimate objective [02:19:08] to find that line. I have not yet reached to that goal. what we are trying to find out right now the line with the minimum error but I'm still trying to struggling to find out how to find the error good [02:19:27] calculate the error as I said that that we can also take the squared values that we can also take the squared values that means suppose if I have this two minus4 means suppose if I have this two minus4 so if I take minus4 the square [02:19:41] it up and put a square root after it. What I'll get is a plus four, isn't it? [02:20:07] take up the same error calculation formula that we have taken up earlier formula that we have taken up earlier into this. I'm going to apply that I what I want to do is take the summation of the squared value of the error. So y [02:20:21] actual minus y predicted the whole square sum up the squared terms and take the average of it. So what I'll get is average squared error or what I'll get [02:20:34] average squared error or what I'll get is average squared error [02:20:47] representation of the error but that will be a squared representation right value isn't Or I can call that as mean squared error [02:21:17] So if I take the square of the errors and take the average of it mean squared error. If I take the absolute values and take the average of it, I'll say that as a absolute error. Is that okay for everyone? [02:21:32] Now if I just put up a square root over it, since these values are square terms, so I need to put up a square root on top of it in order to get the values to the [02:21:44] same scale as I have the original data. So I can put that as RMSSE root mean squared error. We'll discuss RMSSE slightly later. What is the role and importance of RMSSE? That's not required right now. Good. [02:22:01] Now let me ask you which one of these two do you think is a better approach towards the error? Because I have given you two approaches to calculate the error. either I can take up the average of the absolute values or I can take the [02:22:18] average of the squared values of the errors. What do you think is a better I'm leaving the decision to you right now. [02:22:45] Then I put up a hypothetical situation for you where I'm taking up only two columns in front of you [02:22:59] because of some issue. This is my y actual value and this is my y predicted actual value and this is my y predicted value. Good. [02:23:14] So y actual is 1 2 3 4 5. Y predicted is 4 6 7 9 Y predicted is 4 6 7 9 50. [02:23:33] find that is not useful but I want you guys to calculate do the calculations for me. Find out what is the value for MS for this and what is the value of M MS for this and what is the value of M AE for this. [02:23:59] -4, -4, -5, and - 45. So only term I'll struggle with square of - 455 [02:24:49] MSE. If you talk about ME value, so that's going to be 7 + 4 11. 11 + 5 is 16. 16 + 45 [02:25:07] that's 10.16. Now you might say that this is a squared term. [02:25:19] So I can take a square root of it to bring it to the same level. [02:25:50] 20 is 48. So maybe 20.4 close to that value not exact but somewhere around 20.4. somewhere around 20.4. Good. Now if I talk about the comparable [02:26:05] Good. Now if I talk about the comparable ratios I have 10.16 and I have 20.4. Now I will ask you a simple question. Look at the error values these error gaps. I have -3 -4 -4 - 5 - 45. Which one out [02:26:23] of the ME value and RMSSE value which one do you think and RMSSE value which one do you think is a better representation of the error? really if I talk about if you think about the conceptual part [02:26:45] in terms of concepts what I'll say here is the RMSSE is a better representation it is a better representation always it is a better representation always than me it's a better representation [02:26:57] than me it's a better representation in terms of understanding the error In terms of representing the error, RMSSE is a better matrix than M A. Why [02:27:09] RMSSE is a better matrix than M A. Why is because the value of RMSSE I can is because the value of RMSSE I can compare with MAE always. And if there is a significant difference between RMSSE and MAE, that means my MAE value is [02:27:24] and MAE, that means my MAE value is lower and the RMSSE value is significantly higher. That tells me very specifically that That tells me very specifically that there are certain predictions which are [02:27:37] there are certain predictions which are not very good. They are going way beyond the rest of the errors. certain errors are huge because of which my RMS value is getting higher or presence of an outlier in my error [02:28:03] if there's a significant amount of difference between ME value and RMSSE difference between ME value and RMSSE value I will understand it that in my predictions for certain input values I am getting very exceptional or [02:28:20] values I am getting very exceptional or very out of the box answers [02:28:36] values these are sensitive to the outliers. outliers. These are sensitive to outliers [02:28:48] in the data and hence is a better metric in terms of and hence is a better metric in terms of comparison, right? Or in terms of understanding the errors in the data. [02:29:31] Just change that error. Similar situation. What if I just change that zero, make it five, make that error as zero. You will notice that there is no significant difference between MAE and [02:29:45] RMSSE. So if data does not have an outlier present, the results does not have an outlier present, I will have very minimal or almost like no [02:29:58] difference between MSE value and MAE value. [02:30:10] outlier and if there is a presence of an outlier RMSSE will always show us a better picture. Are we good on this point till now? Yes. No. Maybe team quickly. If it is not clear ask it. [02:30:45] All right. Considering no input as everything good, information. Right? I want to look beyond it. Similarly, when I calculate [02:30:59] the error, right? Suppose there is some actual value, some predicted value. Good. What I'm expecting is a minimum error. [02:31:11] What I'm expecting is a minimum error. This is my minimum error. Good. So for some data I'm getting error in the range of let's say in the range of 10 up to 10, right? Up to 10. Let's say 10 to 7. But [02:31:26] for some value the error reaches out to let's say 150. let's say 150. Rest of the errors are in the range of 0 Rest of the errors are in the range of 0 to 10. Good. But this one of one odd [02:31:40] to 10. Good. But this one of one odd error is 150. Make sense? [02:31:56] kind of would you not like to notice why is that error happening? [02:32:08] If everyone is going in one way, why is something going in different way, right? And you would want to pick that up. You want to pick it up. Now, M AE [02:32:22] will not allow you to understand that abrasion, the presence of such kind of thing. Whereas with MSE which is sensitive to this outlying information I can find it up easily [02:32:37] up easily that there is a possibility of such that there is a possibility of such outlying errors. So always MSE or RMSSE you can say either terms because RMSSE is comparable to MAE that is why because [02:32:51] they belong to the same unit because MSE is a squared form so not comparable but ME and RMSSE are comparable. Good. [02:33:07] better picture of the presence of an outlier or not. If M ae and RMSSE value both are almost close to each other, I can assume that there is no presence of [02:33:19] an outline error. Almost all the errors are in a finite range. If there is a significant amount of difference, let's say 20 and 20 double the error of 1.5 times MA RMSSE value is 1.5 times [02:33:34] the MSE ME value. There is definitely certain data points which are getting extremely wrong class wrong predictions which I do not want. [02:33:46] Make sense? So because of the sensitiveness to the outliers we prefer sensitiveness to the outliers we prefer MSE or RMSSE model for calculation of MSE or RMSSE model for calculation of the errors we prefer that however when I [02:33:59] am going to judge the performance of the model I will look into everything. I will look into MAE, I will look into RMSSE, I will look into MSE and I'll also look at another matrix called as R². [02:34:17] I will look into everything. But if I have to do some calculations mathematically, better representation is RMSSE or MSE value. I will not put RMSSE but MSE mean squared. That is a better representation. Why? [02:34:32] One more reason coming into the picture why I would like to use MSE and not M why I would like to use MSE and not M AE. [02:34:52] for this I would like to bring again some more concept. How many of you understand differential calculus? I am not very bad at it. Let's say so I I am not very bad at it. Let's say so I have an equation 3x + c [02:35:08] or let's say 3x + some constant number 2. y = 3x + 2. A simple equation. [02:35:25] Now I'll ask you what if I do a delta y by delta x. I wanted to do a me a dy by dx. Will that be equal to three? [02:35:54] Now what if I make this y = 3x² y = 3x² + 2. I've just made one change. Instead of a linear equation, I have made it a squared equation. Good. No other change. [02:36:16] Now you will have the difference dy by dx the differential value. dx the differential value. Now think about this for a moment. In earlier equation when I had 3x + 2, your dy by dx was equal to 3. Now can [02:36:31] your dy by dx was equal to 3. Now can you tell me the differential value that I'm calculating? Where is my differential value dependent Where is my differential value dependent on the input x? Is it dependent in this [02:36:45] on the input x? Is it dependent in this form or is it dependent in this form? [02:37:05] It depends when my equation is in squared form right because in squared form I will get my independent variable right also play a role in the differential. Is that okay with everyone? Those who do not understand [02:37:19] definition, I'm okay if you do not understand it. I'm okay with that part. know about this when someone will teach you about gradient descent mechanism. [02:37:33] descent in detail right now but give you slight amount of idea. That is my ultimate objective in order to find a line. That means I want to to find a line. That means I want to find a line which is y = m x + c. [02:37:53] Good simple understand. I'm putting that as yhat. That is my prediction line. Great. Now That is my prediction line. Great. Now if I take that particular yhat then for [02:38:07] that particular yhat value I will have an MS value mean squared error value an MS value mean squared error value right can I put that as sigma [02:38:19] right can I put that as sigma y - yhat the whole square by n is that okay [02:38:33] that is the average error I'm going going to get up. [02:38:54] But this line may or may not be an optimal line. I might have another line which is better than this line. Correct. [02:39:09] I might have a line which is better than this line. Let us take up another line. Do we believe first of all that this line might throw up a different error, [02:39:39] What I would have to identify whether this MSSE value for this line is lesser this MSSE value for this line is lesser than the previous one or not. Is it low or not? If it is low then I will change my [02:39:55] If it is low then I will change my solution from the random solution m and see to that new slope and new intercept. to that new slope and new intercept. Correct? [02:40:10] about it. There are two important things I want to bring up in the equation of that line. What does M controls and what does C controls? [02:40:22] M controls and what does C controls? The M controls the vertical movement of the line. That means not M but the C. The C controls the suppose this green line. I can keep on moving that line like this up and down. Does the slope [02:40:37] like this up and down. Does the slope change? No. The slope remains consistent on that line. The only thing that changes is the angle. Sorry. uh the intercept value right where it is cutting the y-axis [02:40:52] that changes but the inclination remains the same so I can have m constant change in the c values one change good second change I can have is which I cannot show it up here but the m if I [02:41:10] cannot show it up here but the m if I keep the this thing constant I can have intercept where the slope is going to be different, right? I can have either m changing c [02:41:25] right? I can have either m changing c constant or c changing m constant. constant or c changing m constant. Make sense? [02:41:47] Now can you tell me how does the equation of of square term looks like? [02:42:01] quadratic equation any quadratic equation it's pictureization will look equation it's pictureization will look something like this [02:42:20] chose up a random value of for m and c there sensible see team I'm going to deep. If you guys do not want me to go that deep, I'm okay with that part. But I can tell you once you understand [02:42:35] it, there is no nothing will be left behind. So we started with a random value of M and C at the beginning. and C at the beginning. Right? So let us assume that this is the [02:42:48] curve. This is the curve representing the mean squared error relation. Now I'm going to write that equation again. Y is equal or my error let's [02:43:01] assume that is represented by letter J is equal to and I'm taking the total error equation not the average. Good. Sigma Y of I minus can I put that as MX + C [02:43:30] I have replaced yhat with mx plus c the equation of the line. Good. random value of m and the random value [02:43:44] of c good I will get some error total sum error. Make sense? Let's put that up as a point Make sense? Let's put that up as a point on this curve somewhere. [02:43:58] That will be a point somewhere here. Let's say good. equation of my error, then your objective will be to reach out at this [02:44:13] objective will be to reach out at this level. This is your minimum error, isn't level. This is your minimum error, isn't it? [02:44:35] which thing I can vary. I have a fixed value of X which is my input and I have value of X which is my input and I have a fixed value of Y which is my output. So can I change them? No. What I can play around with is the [02:44:51] No. What I can play around with is the slope and the intercepts. Acceptable. [02:45:12] with that slope and intercept value which we started randomly at what I will do here is I will take a partial differential. Now many of you may not understand it but I'll take a partial differential of my error term DJ by DF. [02:45:27] I will differentiate on one dependent term which is M and I'll also take a term which is M and I'll also take a partial differential with respect to C. [02:45:43] have terms which are independent and dependent of both M and C. Agreed? By this I will be able to find out a [02:45:56] equation a value of M and C such that I have made some minor changes to the value of M and C so that it reaches out value of M and C so that it reaches out to some point lower [02:46:17] does it reach out there but try to understand what I'm trying to convey. understand what I'm trying to convey. Let it reach out here. [02:46:32] to this error. Then from here to here, then from here to here, then from here to here, and maybe with small minor changes, I might reach out up to this changes, I might reach out up to this point. [02:46:50] So there is a lot of differential calculus involved into that shown up in this picture is called as a gradient descent mechanism or gradient descent approach right this is typically followed in [02:47:06] order to minimize the error objective is what is my objective I my objective is to find the minimization of this function I want to minimize this for the [02:47:18] the partial differential of this equation that's it partial differential why partial differential because I have two dependent variables m and c I want two dependent variables m and c I want to vary both of them [02:47:42] I will eventually reach out to a point where I will be able to find out the where I will be able to find out the value of M the slope and the intercept C such that that I have the minimum amount of error. Are we good? [02:48:24] our line which is my prediction line containing the minimum amount of error. containing the minimum amount of error. Good. That is linear regression questions. All right. Now I'm going to put across that in a slightly different [02:48:40] put across that in a slightly different manner and I'm going to put it down or I'm going to change up some technical terms for you. Till now what we have been doing is that I have I was looking to find the equation of a line yhat [02:48:59] to find the equation of a line yhat which is represented as mx + c. Good. where I am finding or I'm predicting that on the basis of that I have a input column X and a target column Y given [02:49:17] and based upon the input of these two I am predicting that this is my output is am predicting that this is my output is that correct [02:49:33] fit line and C defines times the intercept of the best fit line. [02:49:45] Now I'm going to write this equation of line in a different manner. What I will line in a different manner. What I will write it down as y is equal or yhat is write it down as y is equal or yhat is equal to beta kn [02:49:57] equal to beta kn plus beta 1x [02:50:09] nomenclature change. Uh and the terminology change. I have been calling terminology change. I have been calling this m as the slope of that line and this as the intercept. I can still use the word slope or [02:50:25] intercept. It's quite understandable in the fraternity. But when you get into interviews or professional way these have a different terms right. This term which is associated which is a multiplier of m of of the indep of of my [02:50:40] independent variable x I call that as the coefficient of regression. We call the coefficient of regression. We call that as coefficient of regression [02:50:54] for variable x. Good. And the term beta kn is still called as intercept. There's no change into that. There's no change into that. Good. [02:51:13] changing now to beta 1 and c is now changing to beta kn. Rest of the equation, rest of the concept, everything is same. No changes. Thus the representation of the equation changes slightly. Now [02:51:28] now we'll bring out the simp linear regression into two parts. The linear One is called as a simple linear regression and the other one is called as a multiple linear regression. Good. What is the difference? Whatever [02:51:45] example that I've shown you or I made you understand till now is an example of simple linear regression. What is simple linear regression? When I have one input feature, there is one input feature and one [02:52:00] target variable. Right? So my prediction equation is going to look like yhat is equal to beta kn plus beta 1x. Please [02:52:13] remember beta 1 is nothing but the slope of the line which it makes with this particular input feature. Good. Now what if I have a data like [02:52:25] Good. Now what if I have a data like this? [02:52:38] and I have a target variable y. So my prediction will look like y is So my prediction will look like y is equal to yhat is equal to beta plus [02:52:53] plus beta 1 x1 beta 1 x1 plus beta 2 x2 plus beta 2 x2 up to plus beta n xn. [02:53:10] just ask put it across. Let me put across with two input variables as an example. That's something that I can show pictorially. [02:53:23] Right? Suppose I have two input variables. your input feature X2. And this is my target variable Y. [02:53:35] Good. Now think of my prediction line. My Now think of my prediction line. My prediction line is a straight line [02:53:50] like this. Now this is 2D screen so not imaginable but if you have a pen or something handy with you try to put that pen on the center of that screen or pen on the center of that screen or somewhere think of something protruding [02:54:03] somewhere think of something protruding out of your screen. Right? That particular thing will make a different angle [02:54:15] with this axis and will have a different angle with this axis. Correct? may be same. They may not be different. Whatever it may be. [02:54:33] Whatever it may be. Yes or no? to x1 is something different. The slope of that line with respect to different feature x2 is different. So I represent the slope with x1 as beta 1. the slope [02:54:50] with x2 I'll represent that as beta_2 or with if I have you know hypothetically present n different columns for each different [02:55:02] different columns for each different feature it is it will have a different slope I will not now use the word slope I will have I will use the word coefficient of regression what essentially the coefficient of [02:55:15] regression represents I will talk about that too when I I will explain R². what is the relevance in terms why we are not using the word slope and using [02:55:30] the word coefficient of regression. What exactly it brings it? It brings in a lot exactly it brings it? It brings in a lot of things. [02:55:45] Just a quick question to you. All right. So, that looks fine to me so far. will say that as a simple linear regression. If I have multiple input [02:55:58] columns, I will say that as a multiple linear regression questions. [02:58:04] before the break, I will just import that data set uh import libraries onto my machine and then import that data set and just look at the head values just a basic information about the data. Nothing much uh before I have to build [02:58:19] up a new concept about train test split. So before that up to that point not too far off. So very quickly import the libraries. [02:58:40] expected team that you will be doing along with me. Import numpy as np. along with me. Import numpy as np. Import the mattplot lab [02:58:56] import sebond. I don't prefer that way. If you want me to do it that way, I'll do it. No problems. But what I generally prefer is people typing the codes on their own. Take your time. Type it up. Time is not a constraint. [02:59:35] drive. I'm using a local machine read CSV. It's by the name TV marketing.csv. [02:59:50] columns. I have a TV column and a sales column. Good. Quick look. So two columns I have range index of 200 [03:00:05] entities. Both are numerical. 200 non-null. So no missing values nothing like that. Good. some observations. I'm not putting those things into the picture. Good. [03:00:25] Next objective that we have to do is to train and test the model. So before the break, we started off with one of the data sets called as the TV marketing CSV file which contains two columns. One is the TV column, other one [03:00:40] is the sales column. Right. And my objective here Right. And my objective here is to predict the value of sales based upon the value of TV. Now the number of TV the value that you see per [03:00:54] TV is some marketing cost right some marketing cost of the televisions and the sales values are reflecting the amount of sales that is happening. Good. So if I put a 230.1 marketing cost uh the sales value is [03:01:09] marketing cost uh the sales value is 22.1. If I put up 44.5, the sales value is 10.4. Essentially, what we're trying to find out to find out the relationship between TV and sales [03:01:39] What happens is that we have a finite set of data being given to us. Right? In this particular example, I have two columns like this. I [03:01:51] have a column of TV and I have a column of sales. Right? Or in general, I will put up I have an input column given and I have an output variable. I'm representing that with the uppercase letter X and a small [03:02:05] letter Y. Why I'm putting up the input as upper case is because I may have a single column. I may have a combination of columns, right? Multiple number columns can also be possible. So in general, we [03:02:18] represent the set of independent features or all the independent feature columns as uppercase X and the target variable is usually represented with small little Y while doing you know the nomenclature and representation. [03:02:34] nomenclature and representation. Now what is my objective? My objective Now what is my objective? My objective is to create a model. A model means I need to find out that relationship. So my objective is to find that yhat is [03:02:47] equal to beta plus beta 1 plus beta 1 x in general. Good. That is my objective. Now in order to achieve that objective, let us suppose I [03:03:05] find out that objective. I create up that equation by the given data. But I that equation by the given data. But I also need to verify how good is that also need to verify how good is that right? Is it performing good or not? [03:03:21] right? Is it performing good or not? So what we do eventually is first of all I will separate my data into two parts right I'm going to separate these two inputs and output separately I will [03:03:37] create a separate set of input and a separate data for output X and Y and a separate data for output X and Y are segregated now good after this I am [03:03:49] going to choose some percentage of data points of X and I'm going to divide X and Y both in some ratio. [03:04:04] divide X and Y both in some ratio. Usually that ratio lies between 7030 to 8020. That's a common practice. You can have any other ratios. You can go 60 can have any other ratios. You can go 60 40, you can go 9010, [03:04:21] onto that but yeah it is usually between 70 to 80% bigger chunk and 30 to 20% the 70 to 80% bigger chunk and 30 to 20% the smaller chunk now what is the objective [03:04:33] I am going to randomly choose out certain set of rows certain set of rows let's say I ch defined 70 80 ratio 7030 ratio so out of total number of rows that I [03:04:48] have randomly select Check 70% on one side and remaining 30 on the other side. side and remaining 30 on the other side. Good. And the same set of rows Good. And the same set of rows corresponding y values 70% on one side [03:05:03] corresponding y values 70% on one side and corresponding y values on this side. So essentially if I took a think about it I have divided my data into four se it I have divided my data into four se different sections now [03:05:21] right the major portion that I have that is 70% portion usually right I call that as a train portion right I call that as a train portion and the one that I've used here is a test portion [03:05:35] the very obvious question that arises is why do we have to do this? why do we have to do this? Okay. So let us bring some real world Okay. So let us bring some real world perspective. [03:05:59] give it some data which is consisting of my input values and my output values. Based upon the understanding of machine of this input data, my machine is going [03:06:12] to establish a relationship and create my model. Yhat is equal to some relation. Good. How it will find it? Based upon some [03:06:24] How it will find it? Based upon some algorithm. Good. Is that okay? [03:06:40] Now if I test if I test this particular model or this particular relation that we have identified on the already used inputs right I whatever the already used inputs are which my machine has already seen if [03:06:56] are which my machine has already seen if I give those inputs it is more likely that it is going to give me quite matching outputs because it has already seen that thing, right? What do I want it? That I should [03:07:12] right? What do I want it? That I should be able to supply some inputs but my machine has not seen those inputs before in the past. So that I can testify how in the past. So that I can testify how is that model performing [03:07:31] in order to judge or evaluate the model's performance. Does that make model's performance. Does that make sense? [03:07:50] confirmation coming through. Let us imagine that you are a model. You are a m model, right? Your objective is to learn. [03:08:03] You're let's say I am your you know guide. Now I have a pool of 10 questions. I have a pool where I have 10 questions and their corresponding answers. 1 2 3 4 5 6 [03:08:18] 7 10. Okay, I have 10 questions and they're corresponding. This is what I know. I already have it. Now what I will do here is out of those 10 questions, do here is out of those 10 questions, I will supply you seven questions and [03:08:33] their corresponding seven answers. I'll tell you both. I'll give you those seven tell you both. I'll give you those seven questions and seven answers. Good. What you will do? You will learn from those seven questions and seven answers [03:08:45] and make an understanding about the questions and answers. Agreed? [03:08:58] learned something based upon the inputs that I gave the seven question and seven answers. Now I so that is your learn thing. Now but once you have done that learning I still have a bank of three questions [03:09:14] and their corresponding three answers. Right now what I'll do is I will only Right now what I'll do is I will only supply you those three questions and ask you to give answers based upon the learning that you [03:09:27] acquired from those seven questions. Does that make sense? [03:09:39] you objective I am dividing my set of objective I am dividing my set of original 10 questions into two parts. One of the part is I am using to train you or give you for learning and the [03:09:55] second part I am using for testing. Is that good? So the division of my data for the purpose of evaluation of the model [03:10:40] is what we call as a train test split. Good. So, shall we do it? [03:10:53] need to do? I need to divide my input features separate and target variables features separate and target variables separate. So I have a data set. [03:11:39] Here I can write down this is equal to in my data frame df [03:11:51] one and y is equal to my df do iilock [03:12:16] Done. I will have X now as a data frame and Y as a series. [03:12:48] randomization. So I will not do it manually. I'll use for the first time take a help of a library another new library [03:13:08] evaluate the model dividing the data into two parts a training set and a testing set. The model is trained on the training set and learning the patterns and parameters and then evaluate and test how well it generalized to the [03:13:21] test how well it generalized to the unseen data. [03:13:35] library and I'm going to use selective things from it. So I will not import the entire scikitlearn module. I will import the very basic functionalities and [03:13:47] classes wherever whatever is required from scikit learn. Right? So as of now my objective is to perform a train test split. It's a function available in split. It's a function available in circuit learn uh [03:14:01] model selection module subm module. I'll take that up. So from scikit learn this take that up. So from scikit learn this is skarn selection. You may not you know think that okay [03:14:17] recall those things but over the period of time with practice you will remember those things what is the purpose of doing train test split it is a activity doing train test split it is a activity that allows me to help evaluate the [03:14:31] model why I would like to evaluate the model because I want to select the model I want to choose a model so that is why it is put into the model selection it is put into the model selection submodule I'm going to import [03:15:01] great now this is a beautiful function right what does it do is it is a very basic syntax it creates a numpy array right and it can split you know any sparse matrix or you can say a data frame [03:15:17] or you can say a data frame right listen to that very carefully I will write down the function name first train test_split I want to split my x [03:15:34] when my x gets splitted it creates two section one is the x training section and the second one is X testing section. Good. [03:15:49] the way I am splitting the input X, I also want the same split strategy to be also want the same split strategy to be applied on Y2. So, I'll put up Y. [03:16:01] Next term is Y. And when Y is getting splitted up, it will show me Y train and Y test. Two things will come out from Y. [03:16:13] from Y. Good. portion do I want to be given for testing and how much portion do I want to take it up for uh training [03:16:33] I can use either a train size or I can use a test size. So what percentage of my total data I want to use for training and what [03:16:45] percentage I want to use for testing. So usual term is we tell the test size remaining becomes my train size. So test size I'm taking up 0.3 I want to take up size I'm taking up 0.3 I want to take up 30% as training data or testing data and [03:17:00] 30% as training data or testing data and remaining 70% as testing data. Oh sorry training data my bad. Last property very important is random state. [03:17:15] different sections. I have got my data divided into two I have got my data divided into two parts. I have this input X. This is target Y. I have got my X train portion that is for training. Corresponding [03:17:29] target variable values is Y train and I have got X test data. Now what do and I have got X test data. Now what do I need to do? I need to supply this to I need to do? I need to supply this to my untrained model, [03:17:50] right? So that it can train itself sensible. Once it gets trained, I will look its evaluation on this data. [03:18:14] So let us now since the data is now ready, let us now evaluate. Let us now ready, let us now evaluate. Let us now train the model [03:18:29] When I say train data set that means I have input data and output data both. So in order to do this I need that raw model or blank model right. So scikit model or blank model right. So scikit learn for every type of model has a [03:18:44] submodel available. Since I am going to talk about a model which establishes a linear relationship. So it's a linear model that I'm going to create up. All the linear model are available in a particular submodel of scikit learn [03:19:00] called as linear model. So I am going to import linear regression class from import linear regression class from scikit learn linear models module. [03:19:27] linear model module. Right now, an instance of this linear regression class will act as my model. [03:19:53] linear model there are other linear models as well. So this is the first one models as well. So this is the first one I am going to import. [03:20:12] create an instance of this linear regression class. create an instance [03:20:36] I'm naming that as linre rag is equal to linear regression. That's how you create an object of a class. class name followed by a pair of parenthesis to call its constructor. Done. [03:20:50] Great. Now I have got a blank model, an untrained model. Just check it out. I want all of you to use that lin paste it up and execute. Some of you might be getting this kind [03:21:05] of box and orange color. Anybody getting this? collab people may not have exact thing but should have something. [03:21:19] Now I will hover around my mouse and I can see there's a question mark on this that is documentation for linear regression and then there is an iota sign or I sign that's information. Let's hover it on it. What does it say? Not [03:21:34] hover it on it. What does it say? Not fitted. Not fitted means what a not fitted means that this particular model has not yet [03:21:46] that this particular model has not yet seen any data. When a model gets fit, a model is fitted that means that model has seen the data and has learned from has seen the data and has learned from that data. [03:22:08] So what is my next objective? Next objective is to get this untrained model objective is to get this untrained model the training or I need to fit the model. Let us let us now [03:22:47] So how will I do it? I will ask my lindre model classes that we have right whichever class that you will think of [03:23:03] in scikit learn each of the model class has a function called a spit a method called a spit which is used to train the model it is defined in that way. So and model it is defined in that way. So and I'll need to expose what the data. So I [03:23:18] will tell what is my training input and corresponding output X train and Y train corresponding output X train and Y train frame. Good. What is now going to happen? This linre object is going to look at this train [03:23:32] object is going to look at this train data from training data whatever it has and based upon that training data it is going to find out the MSSE value for a going to find out the MSSE value for a random M and random slope and random [03:23:45] random M and random slope and random this and then try to minimize that MSE this and then try to minimize that MSE function to get to a value of M and C so function to get to a value of M and C so that it finds out optimal value of M or [03:23:58] that it finds out optimal value of M or Good. You don't have to do that manually. Model will do it for you. [03:24:14] box. Instead of the orange one, I see a blue box. And when I hover around my blue box. And when I hover around my mouse onto that I sign, it says fitted. When it says fitted, that means it has seen the data. [03:24:28] seen the data. Are we good? If it is fitted, that means it has identified the slope and the intercept. [03:24:41] identified the slope and the intercept. Correct? the intercept values. So let's try to look at this. Let's print [03:25:17] only have one variable. So I can put that down directly. That is lin rag. that down directly. That is lin rag. that is my model unders dot coeff. Now that's a predefined class variable a class attribute which captures the [03:25:34] coefficient of regression for all input features. So coeffers and in a similar fashion I have another class variable [03:25:58] coefficient of regression and the intercept value. intercept value. Now on this on this basis can I write down I have got this thing now. So I have got [03:26:12] my beta 1, right? This is my coefficient. I have got my beta KN. So can I write down predicted sales predicted sales is equal to the beta not 7.23 something [03:26:27] is equal to the beta not 7.23 something right plus my beta 1 that is 0.04 104 right plus my beta 1 that is 0.04 104 times PV. [03:26:44] isn't it? Or I can say my predicted sales this number multiplied with oh sorry plus [03:27:04] multiplied with the value of TV actual value of TV. Do we agree? Straight line equation. [03:27:27] number three. So my value of TV is 151 and my model So my value of TV is 151 and my model predicted uh the actual value was 18.5. [03:27:43] Good. Let's keep that into picture over there. Let's keep that into picture over there. So if I go by this equation, [03:28:02] So my model predicted the value is 14.27. This number [03:28:14] predicted 14.27 whereas the actual value was 18.5 so can whereas the actual value was 18.5 so can I find out the error yes my error is 18.5 minus [03:28:28] you don't have to do this at all just wanted to make a picture clear for you 4.22 to two. That's the amount of error that is happening on that one particular that is happening on that one particular data point. Is it [03:29:21] training inputs and the tests inputs. I'll tell you the reason why we're taking both [03:29:35] good. So let's make that as y predicted values So let's make that as y predicted values for training data. [03:29:56] fit function for every model, we have another function for every model which is called as or another method which is we call it as the predict model. Predict function. [03:30:10] There are two more transform and resample. We'll discuss transform and resample in upcoming time. Good. So what I'm going to use is I will ask now Lindreg is a trained model. Only a trained model will be able to use [03:30:23] predict. I cannot use predict or an untrained model. [03:30:39] do what? Do predictions predict? Predict for what? My training inputs. So, X train that's my training input. Similar fashion I will ask it to predict on the fashion I will ask it to predict on the test set y train y predicted for the [03:30:54] test data and I will just ask it to pass it the test information now [03:31:06] it is going to ah my bad spelling mistake done the predictions good so Huh? Hopefully it's [03:31:39] Now I will not put the evaluation part right in front of you right away but let's have a pictorial representation of this shall we? [03:32:14] So I'm going to create up a graph platter plot. platter plot. I will take x train, [03:32:26] x sorry y train. So that is my input data. sorry y train. So that is my input data. Let's put up a color value is equal to a green color. Good. [03:32:52] want to put up a line or you want to put up a uh dots? The predictions. Predictions is dot or prediction is line. Choice is yours. prediction is line. Choice is yours. Essentially [03:33:09] plot my original data points like this dots. Now I what I'm asking is a line. Okay, great. I'll put up a line. The only difference is in the graph. I [03:33:21] can put up plt.plot. If I use plot, it will plot a line. If I dots. I will use the same input points for X train but instead of plotting it against the Y train value I will plot it against [03:33:39] the Y train value I will plot it against the Y train predicted values. [03:33:55] I can now put plt dot title, right? I can put up this linear regression model [03:34:36] as I have PV on X-axis plt dot Y label I have sales on Yaxis what else nothing plow [03:35:05] show it up in one screen. CLT do figure [03:35:38] as per linear regression model That's the best possible line. Or wouldn't it be better if I can find out this relationship like this [03:36:02] or maybe going downwards like this? What do you reckon? onto the test part two. We have looked at the training data. Let's have a look [03:36:17] on the test data. Do how was it looking like on the test data? So I'll copy the same graph. I could have done it through function [03:36:32] data but I actually wanted to split it out. [03:36:45] So instead of extra I will change data to X test corresponding X test value Y test values here again X test and Y predicted test data uh and here also I'll put up test data [03:37:00] uh and here also I'll put up test data you that looks fine to me now all test points plotted and corresponding corresponding line also plotted [03:37:17] line here and this line here does not look parall to each other may not look why because the scale on y-axis is different on y-axis here the scale is 0 five there a gap of 2.5 here the scale [03:37:32] is 5 10 15 25 so slightly different the orientation might look like but they're essentially Okay, this is going to cut down the y-axis at somewhere around 7.2, [03:37:45] down the y-axis at somewhere around 7.2, right? So does that. [03:38:07] create we had a data. We trained a model a linear regression model. We trained it on training data. We we looked the we we found out the predictions on the training data. We found out its prediction on the testing data too. [03:38:22] prediction on the testing data too. Good. But let's try to understand what meaning does it make to me. It does not make any sense to me up until I can verify or justify whether it is good or bad or should I look at some different [03:38:37] thing or should I stick to the same thing? Do I do not have a choice? I may have certain situations where I might not get a choice. [03:38:59] talk about too many things but let's have a look at four different matrix have a look at four different matrix right rather two matrix I will since I have explained you what is mean squared error so I understand you guys know what [03:39:13] is mean square error but there is another matrix that I'll bring into the picture which is called as an R squar value or R2 score but as of now value or R2 score but as of now as of Now you can assume that R2 score [03:39:28] as of Now you can assume that R2 score is talking about accuracy in percentage me remind and give you a disclaimer. R2 score is not the accuracy of the linear [03:39:44] regression or any regression model. Right? or any regression model. Right? Because MSE, R squar, MAE are your go-to metric to understand any regression model be it linear regression or any [03:39:58] other model. We'll always look at these three parameters. But R2 score generally people get confused that it is the accuracy of regression model. No, it is accuracy of regression model. No, it is not the accuracy. But as of now since I [03:40:11] have not taught you about it, you can assume that for tonight. or let us let's [03:40:27] populate the the performance metric or the evaluation metrics for a regression [03:40:54] and how will I do that again since these are some performance matrix so these are available again in scikit learn under a submodel called as matrix so from skarn [03:41:07] submodel called as matrix so from skarn dot matrix I am going to import mean squared we can calculate them manually but No point. We have already the functions available. R2 score. We'll look into [03:41:21] these two right now. MESSE I'll bring on to a different data. Uh the RMSSE and separate things. You we already have the training testing predictions available. So I can directly calculate let's say mean [03:41:36] squared error that my model made on training data is equal to mean squared training data is equal to mean squared underscore error [03:41:49] when I had y train this is my actual data and y train what was the name that I chose [03:42:07] giving it the actual values and the predicted values these are the only two things that I require isn't it to calculate MSE because what was the MSSE [03:42:20] calculate MSE because what was the MSSE actual minus predicted actual minus predicted the whole square divided by n there that's it that's your MSE mean squad error [03:42:40] value, mean squared function. It will do my job. In a similar fashion, I can calculate the MSSE value for test data, [03:42:58] In a similar fashion, I can also calculate the the R2 sports as well. So I will change the term here R2 train and R2 test. [03:43:11] Change of the function from mean squared error to R2 score. And from mean squared error to R2 score. And so does here. [03:43:30] print them quickly and wind it up for the day. Print. I'm using short notation good that we find. MSE for train data [03:43:56] So controlling a decimal point representation over there MSE test data is MSE test. Then I have R2 train [03:44:21] is R² value for train and I have R2 test I can put up here R2 [03:44:34] Now what do I want to leave you with is to think right this is what I want you to do with good [03:44:54] accuracy right now if you think that my model has already seen the training data, isn't it? It has already seen the training [03:45:06] it? It has already seen the training data. Acceptable. It is making more amount of error on training as compared to testing. Average [03:45:18] training as compared to testing. Average error on training is more than testing. Or in a similar fashion, you can see the percentage. If you think that as an accuracy, I have a lesser percentage here on training as compared to testing. [03:45:32] here on training as compared to testing. Correct? three questions which is he has not seen before it it which is he has not seen before it it does a better job than this [03:45:54] able to do that do do that job not able to replicate that correctly but on something unlearned. So can I say that as an undertrained So can I say that as an undertrained model [03:46:08] it. I will not talk about the reasons right now. is not able to replicate or is not performing better on the things that it [03:46:24] performing better on the things that it has already seen which I expect. questions which I've already seen problems that I've already seen. I know the answers already. I am not able to replicate those answer itself. [03:46:43] how can I expect that I'll do it better on the unseen data? It might do it for on the unseen data? It might do it for some cases but not always. Good. [03:47:01] Did I make any sense to you? >> Talked about a lot. able to reach out to at least performance evaluation matrix because we have a a polomial regression in between as well. Right? So overfitting and [03:47:17] regression and then the performance evaluation matrix because since we have done almost 50% of those I only need to explain R squ which we can do quickly [03:47:30] explain R squ which we can do quickly it's your time [03:47:45] discuss It is going to come up today. [03:48:01] Team as the word suggest underfitting and overfitting. What is the purpose behind it? Okay. Let us suppose [03:48:13] let us suppose I guess all the males and females gender- wise no discrimination females gender- wise no discrimination both of us wear shirts. Can I say that [03:48:33] we would have certain females and males in the house. Both of can agree or disagree. shirt I can say is a common kind of shirt I can say is a common kind of thing that either gender wears [03:48:56] I am building a concept with those shirts [03:49:08] considering Pragati is a feminine gender parting and considering as a male gender. I have one response at least from both genders. [03:49:26] Now let us imagine a situation that this is you or me [03:49:40] you can say a tailor who stitches the garment. Good. Now, if I ask the tailor to stitch a shirt for me, both males and females in the house will [03:49:53] answer. Good. >> And the the the tailor or the garment stitcher, whatever name you want to put up, right? [03:50:06] whatever name you want to put up, right? Has given me a this kind of effect. [03:50:52] Just imagine that's the fitting of the shirt that he has given to me. [03:51:17] a fit for parking. Three different people, three different opinion. A slim fit for mass. I'm okay with slim fit. [03:51:37] Okay. Now, what if today when I got that st what if today when I got that st I was in a empty stomach? Now, when I got the measurements done, I was empty stomach. [03:51:52] Good. My tailor stitched that up at an empty stomach. Make sense? Now when I'm full will this Make sense? Now when I'm full will this shirt which I am finding it completely [03:52:06] shirt which I am finding it completely fit >> or let's say in some situations I went ill [03:52:20] and I lost out on weight and I have become little more leaner. Huh? [03:52:34] >> That is what we want to try with the underfitting and overfitting. underfitting and overfitting. What I want to establish is that when I What I want to establish is that when I create a model, [03:52:51] the one meaning is that it performs good. on train data and and performs good on test data too. [03:53:05] But the performance difference on train and test. and test. I performing better on training data as I performing better on training data as compared to testing data. [03:53:17] Was it good or was it bad as compared to testing? I can scroll back up and you can see the result. This was the information. [03:53:35] You can look at the test and train information. If you do not know R2, I'm okay. Better. Okay. My performance or my error Better. Okay. My performance or my error on training is 11. My error on testing [03:53:49] is eight. So testing error is lesser as compared to the training data error. So the my model is not doing good on training as [03:54:05] model is not doing good on training as good as it was doing on testing. [03:54:19] is a right balance wherein see the ultimately what I want to achieve is and why do I want to achieve achieve is and why do I want to achieve it both things I want to achieve is that [03:54:34] when my model is learning from something some data it can show its performance on the learn data. Agreed? We can check that. [03:54:48] >> Agreed. Yes or no? >> I give you seven questions. You learn from those seven question and their answers. Then I give you the same questions back and you can answer those seven questions. Correct? So can I judge [03:55:04] your performance on those seven questions which I've already given to questions which I've already given to you and their answers. Can I judge that? you and their answers. Can I judge that? So performance on the data which is seen [03:55:27] then there will be a performance which can again evaluate on the data which is not seen because I have never shared those answers. [03:55:46] So I will have a performance on seen data. I can have a performance on unseen data if that is okay with everyone. [03:55:58] if that is okay with everyone. Can I get this performance? [03:56:39] Maybe the Taylor example did not work out. I'll put it up in a different manner for you. Now what I'm trying to talk about an underfitting and overfitting concept right now suppose there is a model right [03:56:55] there's a model the model what is the objective of this model what we have seen is that the objective of the model is to learn [03:57:07] objective of the model is to learn something what it is going to learn let me ask this question this should be answered [03:57:23] In linear regression, what is the learning that my model is doing? What is patterns in the data? No. Bati [03:57:35] in linear regression. No, not in the input and outputs. Parti, input and outputs. Parti, what is my model learning in linear regression? The linear regression model. What does it learn? [03:58:06] >> I'm going to scroll back up slightly. Not uh [03:58:20] learning phase, right? I make that make model learn from the training data. And immediately after that, what did I show you? Two things, the coefficient of [03:58:33] regression and the intercept, the slope and intercept. Did did I show that? That's why model learned. Correct. [03:58:49] coefficient of regression and intercepts. Good. That's the learning part. Now, [03:59:02] when it learns something, right, it is possible that it might learn too well. Now there's a common example that I quote up. So I'll ask a very generic question. [03:59:18] People from outside India, anybody from outside India in the house information outside India in the house information is not performing good on the soul information or the training data as well as the performance on the testing data [03:59:33] is also not good. >> So whatever I've seen I'm not doing good on that. Whatever I have not seen, I'm not going to do do good on that either. not going to do do good on that either. That is an underpit. Make sense? [03:59:48] That is an underpit. Make sense? Why is that going to happen? Because Why is that going to happen? Because I am unable to learn. I am too simple. I I am unable to learn. I am too simple. I cannot capture the concept behind it. [04:00:08] I am the dumbest guy in the house, right? You tell me 2 + 2 is equal to 4, but I never understand it. If you ask me next time 2 + 2, I might put up 22 [04:00:31] that there is a number line and you need to move around plus and minus. [04:01:05] overfitting and underfitting? I want to convey this. [04:01:33] byes variance tradeoff. I will give that a read but as of now what I want you to understand is the overfitting and underfitting. So just give that a quick read up to this point. [04:02:06] whenever we are trying to develop a model, a model might be doing very good on the training data and not doing as good on the testing data. That is an [04:02:19] overfit for me. A model might not be doing good on the training data as well as on testing data. That is an underfeit. I need a model which is doing good on training as well as testing. [04:02:36] That is the objective of trying to talk about all the new science that I've about all the new science that I've talked about so far. [04:02:50] performing good on both training and testing information [04:03:07] right I cannot just make it you know randomly selecting that up I'll give you through coding and I'll tell you a general perception as well a tell you a general perception as well a generic idea [04:03:37] Great. Now I am going to bring in two terms for you. The terms are called as bias and variance. [04:03:53] If I go by the textbook definition, right? [04:04:13] that is caused because my model is simple. That means it is not able to learn the things right. [04:04:25] It is not able to learn things. It's very simple model, right? It is not able to get the information correctly, not able to capture things correctly. The variance is the error that is coming because my model is too [04:04:41] complex. It is doing an overarning. because of which I'm getting error. Right? So variance is an error that [04:04:55] Right? So variance is an error that happens because of overarning and bias is an error that happens because of underarning. Does that make sense? So variance is something that is going to come across [04:05:07] with overfitting and bias isn't something which comes going to come something which comes going to come across with underfitting. find that in the notes. Are we good? [04:05:31] version. Right? What you need to understand in terms of the bias and variance. Right? Now I'm going to put a cross of some set [04:05:43] Now I'm going to put a cross of some set of data in front of you. [04:06:12] Let me name that as D1 and D2. Good. Now very simple question. What is Good. Now very simple question. What is your opinion about the variance for D1 and D2? Which one has a high variance? [04:06:37] So very specifically talks about the spread of the data around the me or disconnect according to my knowledge partly. Why do you say D2 is a high partly. Why do you say D2 is a high variance? [04:06:50] I'm okay to look at your perspective too. But let me know. [04:07:16] fitting is not a problem. I have not talked about the fitting part so far thing. What I've talked about is the variance only just the variance. [04:07:46] prediction line. Suppose I have a line that I have predicted for this data, my linear regression line like this and like this. [04:08:05] bring up the second term we call it as bias. bias. Bias is my difference between the actual Bias is my difference between the actual value and the predicted value. [04:08:25] between the actual value and my predicted value. Now can you tell me predicted value. Now can you tell me where do I have a bias higher and where where do I have a bias higher and where can I have a bias lower? [04:08:39] can I have a bias lower? I have two sets D1 and D2. [04:08:56] Sorry, a high bias here and I have a low bias here. and I have a low bias here. Now out of the these two lines, right, these two prediction line, which one do you think is a better prediction? [04:09:28] and D2 was the variance. In D1 I had a high variance and here I had a low variance because of which the had a low variance because of which the line that was predicting I had a you [04:09:42] know high bias here and high low bias here. Does that make sense? What is the regulating factor over there? there? It is the variance. Correct? [04:10:22] variance and low variance. So the variance still the con consistent. What variance still the con consistent. What has changed here is the bias term [04:10:44] I still have a high bias over here. And I here I can again say that we have a I here I can again say that we have a high bias [04:11:07] low variance and a high bias. When I have a low variance and a high bias, what does it mean? It means that think about it for a short while. I have [04:11:20] think about it for a short while. I have a very clustered data and I am a very clustered data and I am predicting something out of the box, [04:11:32] right? All my people are living in North America. I'm predicting South America. [04:11:45] correct I am predicting South America high bias. I am predicting South America high bias. Does that make sense? [04:12:07] So I have many people from India. Let's say all my cluster of the learners are from northern India and I'm predicting that people are from southern India. [04:12:38] The answer is no. I'm not loud and good. Why? in the current scenario when my variance is low still I get a very high bias that [04:12:54] is low still I get a very high bias that means I have an underfit model my data is very clustered still I am getting too much error [04:13:06] I have a data which is very closely packed up but I am putting up an answer which is way different That means I am making a mistake. I am That means I am making a mistake. I am not able to learn the data correctly [04:13:19] not able to learn the data correctly an under situation. Good. [04:13:47] There can be one more situation where I have a high bias or sorry high variance have a high bias or sorry high variance but a low bias. How can that happen? [04:14:06] predicting a line. It is not a straight line but I am predicting my result like line but I am predicting my result like this. [04:14:32] difference or amount of error in this situation? not make a difference for me but think about the difference between the actual [04:14:47] input the amount of error the bias stuff just only the bi [04:15:12] an overfitit situation because if I have another point here, I do not know whether this line is going to come down here or is going to go back up on that side because this relation is very complex. Isn't it? [04:15:32] That's an overfit. That is overfitting. Right? So when you have a high variance and low bias that attracts overfitting. [04:15:45] and low bias that attracts overfitting. When you have uh [04:16:01] >> a low variance and a high bias low that attracts underfitting. So what essentially we need to do is we need to find out a balance between the [04:16:13] need to find out a balance between the variance and the bias [04:16:26] yes the answer to yes your question is yes where I'm going to discuss the performance matrix kan I will come [04:16:38] across to that today itself but the if you ask me that question right now the answer is yes yes RMSSE does help in understanding how good or bad my model understanding how good or bad my model is [04:16:58] >> so essentially if I talk about and if I have to represent this thing right I can represent the relationship ship between the bias and the variance. If this is your bias and this is your variance, good. So your variance curve will go [04:17:14] something like this and your bias curve will go something and your bias curve will go something like this, [04:17:27] way too young. >> So if your variance decreases right the bias might increase. So at some point somewhere you will have an optimal value of variance. An optimal value of bias. [04:17:43] I might not require a minimum variance. I might not require a minimum bias. A balance is >> or in simple terms if I have to talk [04:17:56] about in a very simple language >> a balance is when and I'm able to replicate similar on testing data I am replicate similar on testing data I am good [04:18:13] you ask it you give me a data that I have seen you give me a data that I have not seen I am saying that I'm 60% accur Correct. You will trust me my 60% Correct. You will trust me my 60% accuracy. Right? [04:18:36] good might have seen that right. If now you're connecting with the live session and now you see that I whether I should be rated three should be five should be four. You know it well. [04:18:49] But am I doing the same thing which is there available on the unseen user and not seen user? If I'm able to replicate it the same way on I'm able to replicate it the same way on seen data then my se my known learners [04:19:05] seen data then my se my known learners make sense. So expectation is important and that is what bias variance trade-up talks about. What I am expecting from the model is my model giving me the similar kind of things or unseen data. [04:19:26] That means my model is able to generalize on unseen data the way it is showing up for the seen data. Does that make some kind of understanding team? make some kind of understanding team? Again [04:19:41] I'm okay with that >> because I know what I have to cover and >> because I know what I have to cover and how will I cover very strong foundation very very strong so that I can you know [04:19:57] very very strong so that I can you know rush through at the end. But questions quickly [04:20:22] In a very simple norm if I have to talk about if you have a low bias about if you have a low bias and a high variance right I will say the data is an overfit the model that I have given is an [04:20:35] the model that I have given is an overfit if I have a high bias and I have overfit if I have a high bias and I have a low variance that's an underfit a low variance that's an underfit right and if that happens [04:20:48] so that means I need to strike a balance between bias and variance. The balance between bias and variance will decide the tradeoff between them. [04:21:00] So I need to find out a particular value. I need to look at a value of bias and a variance in such a manner so that my model has my model has equivalent performance [04:21:18] on the data or the training data or seen data and unseen data or the test data. So my performance as a model on the training data and testing data should training data and testing data should not have a huge gap. [04:21:35] What is that huge that is going to come in practical? [04:21:50] >> I want you guys to give that a quick read. Done. >> Oh, so done. Let's move on. Now what I'm going to do here is practically going to check whether my model is an overfit or an underfit model. [04:22:05] an underfit model. >> Can we do this? [04:22:28] check for overfitting and underfitting. Now there are two criterions as I told you the performance on training data and the performance on testing data is my the performance on testing data is my the go-to thing. I have calculated MSE [04:22:42] train uh the MSSE the mean squared error and R squared values. So I can use either of them in order to judge the overfitting or the underfitting of the model. Good. So how do I want to check it out? [04:23:05] the same file with you. If not let me know. know. Good. So, how will I check it up? If my model's training error, >> listen to that very my model's training [04:23:19] error is MS train. Is that correct? How much error train. Is that correct? How much error it is making on the training data? it is making on the training data? if that is less than the error that it [04:23:33] if that is less than the error that it has made on testing data. So error that I'm making on the things that I've already seen is less than at [04:23:45] that I've already seen is less than at this juncture. things that I've seen as compared to the things that I've not [04:23:59] seen. Is it okay behavior or non okay behavior? [04:24:14] Okay, I guess I'm not >> audible. behavior, >> right? things that I've seen I should be doing good on that as compared to things that I've not seen [04:24:30] that I've not seen >> or my accuracy is greater than >> the R2 test [04:24:51] wife. So either my error on the data that I've So either my error on the data that I've already seen is less as compared to the data that I have not seen or my accuracy level on the data that I've seen is more [04:25:07] as compared to the data that I have not seen. In both the situation I'm expecting an okay behavior. okay behavior. But there's a problem with this. The [04:25:19] But there's a problem with this. The problem is that if that happens, there should not be too much difference, right? Let's say I am attaining an accuracy of 90% of the things that I've seen and I'm attaining an accuracy of [04:25:34] 60% of the things that I've not seen. So there's a huge difference, right? [04:25:48] Think about it. Is it good or bad? I'm giving you two choices. Good or bad. [04:26:04] Let me tell in this way. Pragati has given me her age at 19. Very simple question that passes. So and when I say 19 I'm 90% correct [04:26:19] just an example good pragati has already given me a data that pragati has already given me a data that her age is 19 and I predicted 18.5 [04:26:37] praati is happy good on training data known data busi has an actual age of let's say 20 and They predicted 65 [04:26:52] 90% here correct but on unseen data I am 60% correct. Now tell me is it good or bad? [04:27:18] But on unseen data, I'm not doing as good. Definitely not good. Right? So I need to strike out how much difference [04:27:31] strike out how much difference between the training performance and the between the training performance and the testing performance is acceptable to me on the training data. 90% of the time and I'm doing 85% of the time good on [04:27:45] testing data. Is it acceptable to me as a data Is it acceptable to me as a data scientist? It is my choice as an individual, as a data scientist, as an AI engineer. It's my choice [04:27:58] AI engineer. It's my choice whether I am okay with 90% accuracy on whether I am okay with 90% accuracy on training set and 85% on testing set. There is completely upon upon me [04:28:12] if you talk about me what is the regular practice in industry there is no standard for it a practice part I can tell you should we shall we [04:28:26] situation prevails my model is giving me less error on training >> but more error on testing [04:28:42] compared to the error on testing. Then I can check a comparison if the absolute difference between the R2 to train [04:29:01] and the R2 to test. [04:29:25] I will say that model. Now some people take it as 5%, some people take it as 8%. But maximum usually followed in industry is what 10%. Right? So my error on training data [04:29:40] is more than 10% high. That means I'm getting an accuracy of 90% on training and accuracy of 80% on testing. >> That's a gap of 10%. Is that acceptable? [04:29:52] And you learned your skills right here on RTX twin. >> Then I will say that is French. [04:30:25] level 0.1 is not an standard. It's an industry is not an standard. It's an industry practice [04:30:38] this >> typically no standard you can manipulate it as per your choice. The more stricter you want to go at, it's your choice. I want perfect kind of molecule. Go at 1% difference. [04:30:56] What I've taken here is 10% difference. Good. If that does not happen, Good. If that does not happen, right? That means I have this situation. right? That means I have this situation. Okay. My training accuracy is more and [04:31:10] Okay. My training accuracy is more and testing accuracy is less yet That can happen right? So that is my else position over the else [04:32:02] overfitting. There might be small little bit of There might be small little bit of overfitting that might be happening [04:32:17] but kind of okay. Acceptable to me. Good. Okay, I'll say that okay, it's fine. Otherwise, I'll say it's an over fit. [04:32:31] Otherwise, I'll say it's an over fit. Otherwise, what can happen? The second situation that I put up is an L if condition for the both situations [04:32:47] L if if my mean squared error on training if my mean squared error on training data is more than testing data [04:32:59] situation but in and situation the R2 to train error on training is less than the error on testing. [04:33:37] model may be underfitting. It's an underrit model. increasing model complexity. So I have not talked [04:33:49] about the complexity and simplicity of the model so far. I'll just give that an the model so far. I'll just give that an idea. [04:34:02] prevail then I can have an else condition. condition. Else [04:34:17] model has a balance fit on both training and testing sets [04:34:36] essentially. If you look at this, you know, you would rarely reach out to the situation on a real world data. A balanced fish on a real world data. A balanced fish fit is a myth. [04:34:53] or underfitted. At the most, what we can achieve is either a slight overfitting or an underfitting. That's the atmost. You will never be able to attain a balance in real world [04:35:07] situation. Anybody else got something else? [04:35:27] you guys. Good. I'll scroll back up on my screen. [04:35:39] test plate, I'm going to change my seed number. Let me make it 25. That's my lucky number. Good. Good. I love this number 25. [04:35:56] from here. Remember my last results team? What did I change is only the seed number rest I'm not changing anything [04:36:19] reasonably good. I missed all the spelling that change just because the change of the random state value [04:36:40] well. If you look at my R squar values and performance matrix, the error on training is now lesser as compared to testing and the accuracy on training is higher as compared to testing. The gap [04:36:55] between train and test accuracy is less than 10%. [04:37:08] change my threshold here to 0.05 that I want my model to be at at least there's not more than 5% gap allowed. [04:37:21] allowed. I am getting an overfitted model. [04:37:45] can always use this piece of code to check whether a model is overfitting or underfitting. The only thing that you need to remember is that that you need [04:37:57] to look at this criterion. This criterion whether I want or I am okay with a gap of 10%. I'm okay gap with a 20%, I'm okay with a gap of 5% between [04:38:10] the training performance and the testing performance. Is that okay with all I'm sorry? Now polomial regression I'm sorry? Now polomial regression essentially is nothing different. [04:38:29] What is the difference between a linear and a polomial? from the mathematics. What is a difference between linear and [04:38:42] difference between linear and polinomial? So if I write down equation y is equal to m x + c where x is the [04:38:58] unknown term. x is the unknown term. This is linear x is the unknown term. This is linear right. It's a single line because the right. It's a single line because the degree of my unknown variable is one. [04:39:12] degree of my unknown variable is one. The power of it is 1. If I write down y The power of it is 1. If I write down y = mx² + c, the degree of unknown term is now to [04:39:27] the degree of unknown term is now to quadratic equation, right? Or the degree might vary to three, four, five, six up to ntop. five, six up to ntop. It can have any degree, right? But the [04:39:41] problem is the difference is if the relationship I'm trying to identify is s mx + c right that is going to be a [04:39:54] very straight line. Good. It if it becomes a square term then I'm going to get a slight curved line. If it is a very complex thing I might get something [04:40:06] random. Does that make sense? I can have a question parabola hyperola whatever it may be [04:40:20] depending upon the equation of the relationship if I'm identifying the relationship in the nature of a straight line then I the nature of a straight line then I will have a degree one equation [04:40:39] line. It is any kind of line which is not linear or nonlinear. It is going to be a m you know it's going to be a polomial line or you know line which is [04:40:51] curve or a complex shape or whatsoever you want to say it as right. If that happens that essentially means that we are trying to get up a relationship which is of polomial nature. Do we [04:41:05] which is of polomial nature. Do we agree? [04:41:24] eyes, nose, maybe. Do we agree? Somebody I guess it is getting monotonic right now. Nobody's lacking it. [04:41:50] This is your output Y target variable Y. A straight line without a slope. Slope means that means my slope value is zero. Slope that means my slope value is zero. Slope is equal to Z. Is that what you mean? [04:42:10] Kiran Basco. Great. Now if slope is equal to zero, it means that the tan equal to zero, it means that the tan theta value is zero. theta value is zero. When is your tan theta zero? [04:42:35] When the angle between is zero tan 0 is zero 1090 is undefined it's actually undefined it's divide by zero right so I can see a line where the [04:42:48] angle is zero is like this this is your prediction line now at This point juncture what do you think that does that prediction line which has a slope zero [04:43:02] prediction line which has a slope zero that means the value of m x + c m is now that means the value of m x + c m is now zero. What is the relevance of x? zero. What is the relevance of x? Does x makes any impact the input? [04:43:24] When my slope is zero, it means that the line is parall to my x-axis. That line is parall to my x-axis. That essentially means input has no impact on essentially means input has no impact on the prediction. Not at all. Or input has [04:43:37] the prediction. Not at all. Or input has no role to play in defining the output. Make sense? When the slope of the line is zero. [04:44:05] Yeah. That means no relationship. In fact, I should not use the word relationship. I'm going to use a different word for this. The word is the [04:44:22] explanation. How much is my target variable explained by the input variable? by the input variable? How much is X able to predict Y, [04:44:44] Y shows me a zero degree or no slope at all, it means that X has no role or X all, it means that X has no role or X has no impact in determination of Y, [04:45:03] is still consistent. Right? If you look at this graph [04:45:22] polomial regression understand what is the concept behind polomial regression what exactly polomial regression means right we'll build up the concept first [04:45:34] and then I'll talk about it. How do we implement it? Now think about a linear implement it? Now think about a linear regression problem. Great. [04:45:49] Suppose you have a data, a very simple data. I have one input column X and a one target variable Y. Good. [04:46:06] and a one target variable Y. Good. That contains some data points. [04:46:18] 3 4 5 and six. And a value of y for the corresponding x is 1 8 [04:46:34] 27 64 64 125 [04:46:50] manually what is the relationship? Can you define the relationship y as a function of x? Simple, [04:47:03] as a function of x? Simple, very simple thing. relation in terms of a linear equation, a line? [04:47:26] Can I represent that relations in terms of a line? [04:47:56] What I can do here is I can perform some changes. What I can do is I can represent my x the input feature in polomial terms [04:48:15] or essentially what I'm trying to say is can I not create up [04:48:50] this is just an example. Okay, I have X value that is 1 2 3 value that is 1 2 3 4 and 5 and six. Good. And I have the 4 and 5 and six. Good. And I have the corresponding values 1 8 27 [04:49:05] corresponding values 1 8 27 then I have 64 and then I have 125 and I then I have 64 and then I have 125 and I have 216. [04:49:21] That's the given information to now from the given x can I create in my data the given x can I create in my data frame another column which is x to the power zero another column with the x to the power 1 [04:49:34] another column with the x to the power two another column with x ^ 3 let's put two another column with x ^ 3 let's put up one more line here x to the power [04:49:49] basic thing. Future engineering you might have studied before that column which is derived from the given column. [04:50:17] So x to the^0 I will have 1 1 1 and so on. x to the power 1 I'll have 1 and so on. x to the power 1 I'll have 1 2 3 4 5 and 6. x part two I can have 1 4 [04:50:31] 9 16 25 and then whatever that number is 36 x 25 and then whatever that number is 36 x to the^ 3 I'll have the requisite number but if I try to establish a relationship now [04:50:48] can I say that y is equal to the prediction value that y is equal to the prediction value y predicted is equal = to 1 * y predicted is equal = to 1 * the x ra to 3 column. Let's represent [04:51:03] this column P3. I'm going to represent that column name as P3. Right? So let's name as P3. X to P3 [04:51:15] or 1 * a P3 column [04:51:30] plus 0 * the column P2 + 0 * the column P1 plus 0 * the column P P1 plus 0 * the column P plus some constant zero [04:51:46] where C3 is XQ, P2 is X², P1 is X to 1, P is X to0 and constant I have something. [04:52:07] my input column X into multiple number of features which are the polomial terms of X the input feature. Good. I have [04:52:19] of X the input feature. Good. I have converted into a polomial form of my choice. I can go up to degree 5, degree 4, degree 2, degree 1, whatever I want. That is up to me. Good. And based upon that it converts my input set of [04:52:34] features into multiple number of entities and then I try to establish a line a straight line. Now can I say a line a straight line. Now can I say that this is equation of a straight line [04:52:54] right and that is all what we are trying right and that is all what we are trying to do in polomial regression. in polomial regression I am going to convert a column [04:53:11] convert a column a single column into polomial terms. So what I'm changing is the input terms so that I have the polomial terms of my that I have the polomial terms of my input data and based upon that simple [04:53:25] input data and based upon that simple polinomial terms that I'm extracting considering them as a linear part I'm trying to establish a relationship of the polomial terms with the target variable. Does that make sense? If that [04:53:41] variable. Does that make sense? If that is okay, [04:54:01] this straight line, if I represent that relation like a curved graph like this, that might be a better representation. What do you think? [04:54:14] What do you think? Might be. I'm not saying it is, but it might be. So, I might want to depict a relation [04:54:28] So, I might want to depict a relation in terms of a nth degree polomial in terms of a nth degree polomial instead of a linear equation. Make instead of a linear equation. Make sense? [04:54:42] And in order to achieve that what I can do is I can create that equation. Let's imagine a simple example. Scroll down into white space. [04:54:58] A very simple example. Suppose a data that contains three numbers 1 2 and three. And the target variable 1 2 and three. And the target variable is 1 4 and 9. Good. This is your input x [04:55:14] and this is your input y. Now I can write y = x². Right? Agreed? Yes or no? [04:55:27] But this is a quadratic equation, a polomial equation. Correct? This is a quadratic equation, an equation of degree two, not a linear equation. But can I can I create that in a linear terms? [04:55:51] The answer is yes. How? I can divide this x into two parts. I can say x is uh this x into two parts. I can say x is uh let's say z1 and z2 and I can write down z1 and and let's say z3 I can write it down as z1 is x ^0 so 1 1 [04:56:09] I can write it down as z1 is x ^0 so 1 1 and 1 z2 is x ^ 1 that's 1 2 3 z is x ^ and 1 z2 is x ^ 1 that's 1 2 3 z is x ^ 2 that's 1 4 and 9 [04:56:21] and then I have file. Now I have changed my data. The input now changed from X to my data. The input now changed from X to Z1, Z2, Z3. And now I can reformulate the same thing as Yhat or my predicted line is equal to 1 * Z3 [04:56:39] + 0 * Z2 + 0 * Z1, isn't it? So my slope with respect to Z3 is 1. My [04:56:51] slope with respect to Z2 is zero. The slope with respect to Z1 is zero. Does slope with respect to Z1 is zero. Does that make sense? [04:57:09] value, my predicted value yhat is going to be one. When X is one, my Yhat is one based upon this. Right? because I'm formulating changing X to Z1, Z2 and Z3. [04:57:26] X to Z1, Z2 and Z3. What is X to Z1? X to0. What is X2 Z2? X What is X to Z1? X to0. What is X2 Z2? X to 1. What is X2 Z3? X to 2. So what I am trying to do is I am creating a polomial term of my input variables so [04:57:40] that I can establish a polomial relationship between my target variable and my input variable. Does that make sense team? [04:57:58] linear regression. I'm still trying to establish a straight line but that is establish a straight line but that is divided into parts. [04:58:11] Right? So instead of draw drawing a line I'm drawing a line segment relationship between the independent variables X and the dependent variable Y [04:58:25] as an nth degree polomial. If that makes any sense to you guys. [04:58:39] So for the same data that we have worked before before putting up some theory notes copy paste [05:00:05] What we have is a polinomial regression. The relation between the independent X and Y is modeled as a radial polinomial. A very special case of multiple linear regression. So what I'll do is I will add up some [05:00:19] polomial terms. That means if I have a input feature X, I will find out or I input feature X, I will find out or I create a feature X to0, X to 1, X to 3, X to 4, X to 5 up to whatever degree I want. That is that helps me [05:00:33] want. That is that helps me understanding the relation, right? regression which talks about the curve or nonlinear relationship is a myth. [05:00:48] It's actually a linear regression of polomial input features. What I'm polomial input features. What I'm expecting is that the input features if expecting is that the input features if they have a polomial relationship among [05:01:01] they have a polomial relationship among themselves, I will get a curved line. themselves, I will get a curved line. Make sense? If not, let me know. [05:01:21] before. If you recall it back, I'll scroll it scroll it up. We have the data set right here. I read the data [05:01:33] and I performed a train test split. So I have X train X test Y train and Y test. So I'm going to use the same X train X test Y train Y test. Are we good? [05:01:56] So I'm going using the same train test split data [05:02:08] example. Good. I'm going to use the same data. input features that I have I'm going to convert them to polomial terms. Right? [05:02:39] to create polomial terms. [05:02:51] features. Now I in this particular example I only have one column. So I will have polomial of one column only. Good. Number of polinomials depends upon us. Right? So in order to do that I do not have to do [05:03:06] it manually. Scikitlearn has given me a class which I can use and create those things that is coming from from skarn [05:03:33] preparation part. So pre-processing I'm going to import a class called as going to import a class called as polomial [05:04:02] polomial features. whatever you want it as. Let's name it as poly features [05:04:24] to go with. Let's suppose I want to go with degree four or degree five. Let's for example now this degree term is up to me. I can choose up any degree level that I want. What does degree five means? Degree five [05:04:40] What does degree five means? Degree five means whatever input columns that I will means whatever input columns that I will provide to this object. It is going to provide to this object. It is going to convert those columns to the degree. [05:04:52] Let's suppose if the column is x, it is going to convert it to x to0, x to 1, x going to convert it to x to0, x to 1, x to 2, x to 3, x to 4 and x to 5. [05:05:05] So when I say degree 5, it means I am going to create a column from degree 0 to degree 5. so that I can establish a relationship so that I can establish a relationship with y = x0 + x to 1 + x to 2 and so on [05:05:21] with y = x0 + x to 1 + x to 2 and so on with some constants [05:05:33] so that's my poly features now as per my original data right I have x train and excess so let's try to create up the training data for this particular model and testing data. So I will create X [05:05:50] So I will create X train data with polomial. So poly is equal to and I'll put a poly features that's my object dot. Now any kind of model or any kind [05:06:04] of class I have told you that you have a fit method that allows the data to be learned by the model. So if I can use here fit and I'll tell it x train. [05:06:19] So it is going to learn from the extra data that what kind of data that it has. data that what kind of data that it has. Good. But I do not want to just learn. I Good. But I do not want to just learn. I want to modify this extra data [05:06:40] this. I will first ask poly features to read this data and understand. Once that read this data and understand. Once that is done, I can ask it that you need to make up a different column which is X_ray [05:06:54] or different data poly is equal to the same thing poly features dot transform. Now what is the role of transform? The [05:07:07] role of the transform is whatever the input that I'll give apply the the input that I'll give apply the the algorithm of this object and change the data which is given. So modify the data that's the role of transform right and I [05:07:24] that's the role of transform right and I can ask it to modify x train in a similar fashion I can again ask it to modify the testing data x test poly [05:07:36] let's name that as x test poly and I'll ask it to transform the x test data done now I have a choice with this that I can now I have a choice with this that I can allow this fit and transform to combine [05:07:51] together right the fit of the train and fit of right the fit of the train and fit of the transform the transform at this both juncture I'm using the same data so I can alternatively use a statement [05:08:21] what happens is that's a combination of both fit and transform together. So as I have a fit function as I have a predict function in the algorithms I [05:08:33] have another function called as transform. The role of the transform function is that whatever input data that you give I will modify it and send that you give I will modify it and send it back. sensible [05:08:59] this statement or you can continue with the these three statements. Both are same not doing a difference. Good. [05:09:16] Now just to showcase let's have a look at extra head value dot head that's first five values let's look at first two values only so I had look at first two values only so I had 135.2 and 129.4 four good now let's look [05:09:33] at extra in poly now this is going to be an array so I cannot show it directly an array so I cannot show it directly but let's look at extra in poly col so that I can see the first two rows [05:09:50] only now if you look at the first value let's look at the first value only colon one so that's your first row data [05:10:02] so that's your first row data 135 that's my first value 135 135 that's my first value 135 raised.2 2 to 0. What is the value? raised.2 2 to 0. What is the value? 135 to the power 0. What is the result? [05:10:16] 1. Correct? Correct? 135 to 1. What is the result? Scientific notation 1.35 to 0 raised to 02. That's you can multiply that to the [05:10:33] 10 ^ 1 or 10 ^ 2 sorry. That's 14 135.2. If you take it up as 135 to2 that's here [05:10:46] If you take it up as 135 to2 that's here 135.2 to 3 that's here that's raised to four here and raised to five over there. So what essentially I have done is from a data which was single column I have a single value 135. I have created 1 2 3 4 [05:11:05] single value 135. I have created 1 2 3 4 5 6 values which are of the nature. This 5 6 values which are of the nature. This is value raised to zero. This is value raised to 1, value raised to two, value raised to three, value raised to four [05:11:18] and value raised to 5. Why value raised to five? Because in my polomial features to five? Because in my polomial features I have given degree five. I make it degree three just for the convenience to understand. [05:11:32] So up to degree three is there. So up to degree three is there. Are we good? [05:11:54] now going to create up a simple linear regression model. Let's create up a model. I'm going to name that as poly model [05:12:14] why I'm putting that as poly. Earlier I had the model by the name line. I'm now going to change that to polymodel but from the same class linear regression. I'm still applying the linear regression but this time I'm not going to train it [05:12:29] but this time I'm not going to train it on single variable X but rather I want to train it on multiple number of variables which I have transformed from single variable. So I'll ask polymer to get fitted [05:12:48] dot fit on x train poly with respect to my y train. Good. My model gets fitted on this data. [05:13:47] data fit transform used to non train to generate new feature set that includes the polinomal features and interactions then I've got a transform test data and train the model I have done this part so far [05:14:00] now I don't have to do many changes over there I'm going to go back up here. This was my regression model done. I have done the training. I'm not going to look at the results. I want to do ask to [05:14:15] do the predictions. Okay. Copying the back from the our part. Okay. Go back up. [05:14:33] Then I'll visualize the results. for train data. performance matrix but I am okay with the phase. No problems with that either. [05:14:49] And then I looked at the results on the testing state data. [05:15:03] The only thing that I'm going to change up here in this alt process is the up here in this alt process is the model. The model here is a poly model which I trained on X train poly and Y train correct. So my predictions [05:15:19] train correct. So my predictions I will take up on with respect to here polyodel and here too I'm asking the poly model to do the predictions. Good. But here I'm going to use not the extra original but the polomial because [05:15:35] my model is trained on the polomial terms. So I need to provide it the terms. So I need to provide it the polomial terms only good and let's put up this results as poly p y [05:15:49] poly p y and here p l y. So this is here I will make the difference same figure instead of predictions with the normal terms I'll make it P O L Y and I'll change the name to polomial [05:16:04] and I'll change the name to polomial regression and so does for the test data I can change the predictions to X test poly [05:16:17] and I'll put the it's not a linear regression model but a polomial regression model but a polomial regression model. [05:16:32] Let me execute all of this then I'll ask this question. Now that may not look very good isn't it? [05:16:47] broad line and this is because it is happening because just only for one reason that I'm using a plot function over there over there if I use a scatter function [05:17:06] instead of plot let me put up a scatter plot different Right? I might have a value once or a later. First of all, the first [05:17:20] once or a later. First of all, the first question is it linear? [05:17:43] don't have to do too many things. I can try out with a higher degree. It's degree three. My bad. Let's try out with degree seven. Okay, let's see how does [05:17:55] degree seven. Okay, let's see how does it look like. better a curved kind of situation on this line? [05:18:11] This is on the train data and this is here it's on the test data how will you judge it is better than degree three [05:18:35] how will you judge it we cannot just look at the visualization part we cannot rely on the visualization directly Right? What you need to look at is the mean squared error and R2 values. How do I evaluate the performance [05:19:05] can't say it. I I can talk about it if I just try to I I can talk about it if I just try to go ahead and look at the performance go ahead and look at the performance matrix. [05:19:40] with polomial features. Good. And tests polomial features. And I'll put up train. I have used the And I'll put up train. I have used the word poly. So you might have studied [05:19:54] about the nomature part, right? People say that you need to name your variables very precisely. variables very precisely. You can understand the usage of it. Now [05:20:07] You can understand the usage of it. Now that I am you I have to just modify a single word and I am able to get the results in a different manner just by changing a single word right and later on I can plot up the [05:20:22] right and later on I can plot up the results which I've used here. not the results but the predict but the prints of those and what I'm going to [05:20:35] bring onto the table is the results that I have got without polomial features. So I'll copy this part. [05:20:47] this part. These are my results relation right on straight line relationship I got [05:21:01] on straight line relationship I got these results [05:21:13] and I'm putting a poly 5 a poly 7 right we are using a seven degree polomial it. [05:21:30] train poly, that's the variable. Test poly, that's the variable. I missed out on underscore. [05:21:45] This is here as well. underscore py [05:21:59] good now I can do it so these are my results on training the polomial equation with 7th degree polinomial [05:22:14] good you can compare now My training error which was 10 right when I use the straight line has now when I use the straight line has now reduced on the trend reader to 9.8 [05:22:34] But my testing error which was 14 which is was 11 has increased. So I'm able to reduce my training error but eventually I've lost on my testing error. So is it I've lost on my testing error. So is it good? [05:22:56] Right. Earlier I my model was 63% accurate on training and 55% accurate on testing right that was earlier situation that was approximately a gap of 9%. [05:23:11] now what do I have is a gap of approximately approximately 22%. [05:23:25] If I change the relationship from a straight line to a curved line with a 7th degree polomial what I'm getting is an overfitted model. This is an overfit right. This is slight overfit [05:23:47] or maybe an underfit. Good. lesser degree polomial? Let's see. Let's give that a try with a degree of [05:24:00] Let's give that a try with a degree of polinomial as five. polinomial as five. Good. So, I've changed my degree five. Good. So, I've changed my degree five. I can change my variable names later. [05:24:12] I can change my variable names later. Good. [05:24:31] Maybe I have a better version at degree six or maybe at degree four. But just six or maybe at degree four. But just for your convenience, a simple version. [05:24:48] straight line and my polinomial line. Same data. Same data. Good. Look at this. My training accuracy Good. Look at this. My training accuracy or training error reduced. Good. My [05:25:03] or training error reduced. Good. My testing error slightly reduced. Error on training data is less than testing data. [05:25:15] Both situations acceptable ideal behavior or my percentage of accuracy on training increased slightly [05:25:34] straight line now I've got 64.9 close to 65 slight increment over there 65 slight increment over there without right approximately 2% increment over there but I have not lost out on testing data I have 55.5 earlier now [05:25:50] testing data I have 55.5 earlier now 55.3 not so much significant dip on testing so what I can assume is that a line or so what I can assume is that a line or instead of a straight line if I try to [05:26:03] establish a relationship between y and x in this particular data as a curved line of degree five I have better results than a straight line. I'm not saying [05:26:15] this is the perfect one. I'm yet not saying that. Maybe at degree four I have better results. Maybe at degree 8 I might have a better result. Make sense? [05:26:30] degree I'll get the best results. But what do you think? Now look at this graph at degree five. Just keep looking at this graph. You can make some assumptions with this graph. [05:26:49] let's try do what degree do you want to try any number degree four okay let's have a look at degree four at degree four it is going to create a up to four degree polinomial [05:27:04] features that's how it looks like at degree four degree four almost flat line messy almost flat line messy Isn't it? [05:27:20] relationship than this. Maybe let's look at degree 9. I guess at degree 9 we have the best possible result. [05:27:39] What I will not look at is the graph but the results. Okay. Ah very bad isn't it? On test data I'm [05:27:52] Ah very bad isn't it? On test data I'm getting an R2 of 24.6. So degree 9 is not good at all. So I need to fiddle around at degree four five six somewhere close to that. Maybe at six. At five I have seen the results. [05:28:06] At seven, we have seen the results. Let's have a look at six. So, this is a manual thing team. We would have to do that manually. [05:28:20] while generating the model. That looks kind of good to me. Degree six, kind of good to me. Degree six, that looks far more fit. [05:28:41] I'm coming to a point the degree five looks the best possible solution to me make sense. So if I am now going to create up a model for this, I have two [05:28:53] choices till now. I'm not saying these are my final choices. Till now I have two choices. one choice that I can establish a relationship [05:29:07] as a straight line using linear regression model or I can establish a polinomial relationship with a degree five because degree five is the closest five because degree five is the closest one that I can find out as of now right [05:29:20] there can be multiple things that I can do I can play around with the feature engineering I can play around with the feature terms This may not be very much optimized set [05:29:35] of features. I might have to standardize the set of features. I might have to scale them correctly up. That might give me some more different results. That's quite possible. Make sense? But as of now, [05:29:49] what I can observe is that the results at degree five [05:30:36] world to compare. See, is it possible for you guys to See, is it possible for you guys to compare both the results? [05:30:55] these two things that which one is better a degree five polomial equation or a straight line equation for this particular data set predicting of a regression problem for this part I'm not saying that this [05:31:11] is your final solution what I'm trying to say is that that we have discussed about two solutions two possible solutions to one problem. One is a linear regression with a straight line. Other one is a linear regression with [05:31:24] the polinomial terms or we call it as polinomial regression. Right? Two solutions. One problem I want to predict the sales values. So far what I believe is a degree five polomial equation is better representation as [05:31:41] equation is better representation as compared to a straight line. [05:32:07] you want to agree still not able to agree asky or there's a disconnect [05:32:34] I can still go in deep. If I can extend this session maybe for next 1 hour [05:33:00] over the MSE we should not overlooked that basi as of now. I should not be that basi as of now. I should not be overlooking on those terms [05:33:15] should not be at all because what I will say for you right now is this amount of say for you right now is this amount of dip that I see in the R squar value for dip that I see in the R squar value for the test data. So from 55.5 [05:33:27] so originally 55.3 that I have in straight line I have now got a 55.5. straight line I have now got a 55.5. a slight improvement on unseen data. [05:33:39] a slight improvement on unseen data. There is a improvement in seen data too. Overall if I look at that I see an improvement in all the factors the MSSE [05:33:52] improvement in all the factors the MSSE for test MSE for train MSE RT for train and art for test. I see a straightforward improvement in all straightforward improvement in all terms. [05:34:05] evaluate a regression model, a respective linear regression, multiple linear regression model or any type of regression model, I am not going to regression model, I am not going to overlook R2 over MSE. Never. I am going [05:34:20] to look them in conjunction. Both R2 and MSSE needs to be looked parallelly each other. They carry a different kind of information yet [05:34:33] yet they are both important. only rely on R2 since I have not explained you R2 yet. So I will not [05:34:46] comment on R too much. But what I can show you right now is the amount of difference that we have been able to generate from linear equation to [05:34:58] polomials. Right? That's what I want you to observe and I can definitely see that there is a difference. I have an improvement in all factors in polomial terms as compared to straight lines. If I take a degree five, [05:35:33] basing it by the name [05:35:47] Is there a way to calculate the overall average values of all in each of MSSE and R2 for linear versus poly? Essentially what you want to say if I understood to you correctly that I want to try out polomial equation with degree [05:36:00] 1 2 3 and multiple number of terms and find out the average values across all those terms. Is that what you want to say [05:36:15] interpreted it wrong. Is there a way to calculate the overall average values of calculate the overall average values of all in each of MSE and R2 for linear [05:36:27] all in each of MSE and R2 for linear versus poly? Does that mean linear versus polyderee 1, linear versus polyderee 2? [05:36:56] I have got a value divide by four divide by 3. No that's not possible. this course. If you have any doubts or questions ask them in the comment section below. Thank you and keep learning with simply learn.