# Regression: The Numbers Game Regression – The Numbers Game – Today we’ll be learning about what is regression. So we already saw different types of supervised classification techniques we saw KNN, NB, Decision Trees. So there’s one more classification algorithm i.e. SVM So I currently don’t start with SVM because we need to have certain Concepts or some terms which are there from regression as well as linear and logistic regression that we need to use in. SVM. So for that reason, I just considered beginning with regression.

So let’s begin. So what basically regression is or why we require a regression and classification as in supervised techniques. So just consider a saying in my locality today. The temperature is around 33 degrees Celsius now after 1 hour it just rained and if I want to predict or if I want to say go outside and like for that dependency, I just want to predict what would be the Outside temperature is so based on the previous condition.

I will just suggest what would be the temperature in the next 3 hours or the next four hours. So basically what I did is I have some input variable. Now I try to predict the value of this input variable based upon the previous conditions or previous value data. So what regression basically does is you have some input variable say why and you try to predict the value. Based upon the previous condition So you already have some value which is happened before I knew to try to predict the value of those. So that basically is regression.

So what you do is just consider the scenario where you have this XY plane. So there are some like say points data points scattered here and there so just consider this as the temperature. So what I did is I basically predicted say I just predicted the temperature that is 33 degrees, which is now on different temperature values which are rare. So for example, 27-degree celsius. Now this prediction would be the time that I would be going outside.

So if in the morning the temperature was around 10 degrees Celsius then later after it became like hot what would be the temperature? So these are the various estimates of my temperature. So basically what I have is I just have a set of points or set of values which are dispersed over this entire space so what regression basically does is it just considers a mathematical function so mathematical formulation? For fitting a curve Over these values So what it does is it necessarily finds a mathematical equation so that it will just try to fit a curve or some line on this so that all these points well fix on this curve now say, for example, if your points are like this or if you are values are dispersed in this way what you will have this curve something like this.

So this will have the equation Y is equal to x square or if your curve is something like this. Then you will have the equation as Y is equal to X Cube. So something like So we are points will be dispersed in such a way that you will have to fit a line. So passing through all this point so that it very describes this. So what the condition is, you necessarily do the function approximation.

So this is the term here or you can call this as interpolation. Means you try to fit all the data points inside one particular curve and then you try to predict the value now say for instance. I try to predict the value of this and say the temperature I predicted was around 34 degrees Celsius. Now, what I have is I have a function that is I want to predict the value of this. So I will consider a function as A so.

This is my input variable for which the value changes now for each and every value of A the value of Y changes in this so A is dependent variable and y is predictor variable or the target variable now see for example, if I predicted with this function the temperature of 34 degrees Celsius, but then I checked my app or in my whether-app, I just saw the temperature was slightly different like it was thirty-two points seven degrees Celsius.

So there is some point three error estimate there. So what my function would look probably like this So what I did is I have my prediction here. And so this is the performance indicator. Are they are emerging? Which I have. So I predicted for some value A and I got some prediction now that prediction was not a hundred per cent accurate. So for that, I need to have some error estimate so that it compensates over there. So this is the function of how it is done. Now. The main question is why we need to do the function approximation or what is the need for the function approximation? So for example, you have this function.

So in regression when you just input into a model so you have this regression function. So this regression function you just input into the model. And you try to predict some values. Now just consider the scenario is you don’t have that much strong function or if your function does not consist all of the points, but only of a few of the points. So what we’ll get as an output we will get a less predicted values means your prediction power is not that strong. So what regression does is it have all the continuous values means all the real numbers.

And all the integers It deals with these kinds of values. So whatever real-valued inputs you have you get a continuous range of series values. Now, this can be say for example for the time-series data like you have a particular time of the day, 10, 11, 12 13 and 14 in this you have different values like at 10 o’clock. You had the temperature as 33 at 11 it increase to 34.

Then at 12, it increased to 36 and so on. So what you do is you just try to fit a curve try to pass a curve so that it best fits this equation. Now you understood why we require this function approximation. What does he need for you to estimate this value function that is y is equal to f of x now one question which comes to mind is which of the algorithms to use for this now, there are several algorithms. You have the CNN and that is equal. Convolutional neural networks. You can have a random forest or you can go with AdaBoost.

You have something called as Gradient boosting So you can use any of these algorithms for regressing your data. But which algorithm and when to use this so that becomes are quite challenging or that becomes a complexity, but there is no specific algorithm when to use What scenario so it all depends upon what kind of problem you have? And basically, your data which you have in your and how is your data is randomly distributed or in single continuous time-series manner so based upon that you implement any of this algorithm and one advice is that you try to predict your accuracy based on three of this algorithm.

So it’s always a best practice so it can be said in the analogy like when you go to some particular place or when you go to a strange place and you don’t know that particular location, you probably asked two or three people so that you get lost. The right direction and not land in the wrong direction similar is the case with regression you try to implement with three or four algorithms in you tried to predict the accuracy of this. So well, that was all regarding the concept of regressing machine learning.