Skip to main content

Simple Linear Regression

Simple Linear Regression:


Linear Regression: The relationship between variables such that it forms a straight line.
The Relation that defines linearity in the data is called Co-relation.

Co-Relation:
The correlation in three forms i.e
a)Positive correlation
b)Negative correlation
c)No correlation

What is Linear Regression:
It is all about getting the best fit line that supports linearity in the data is called Linear Regression.
                                            "WHAT IS BEST FIT LINE"?
                                           "HOW TO IDENTIFY BEST FIT LINE"?
  • By using the Pearson correlation coefficient -Allows us to create a basic ideal line
  • Using the error function & Gradient Descent to get a line that has the least error possible.
Now the question is how we identify the line is best-fit?
By using an error function("The Function that holds the difference between actual and predicted value").
  • Mean Squared  Error(MSE)
  • Mean Absolute Error(MAE)
  • Root Mean Squared Error(RMSE)
  • R2_score
                               "Which Error function we have to use"
The main intuition of an error function is to calculate the Low error.
Here we are seeing different  error functions which one we have used
  • we can use any error function it's our wish.
  • In terms of computation time use MAE(mean absolute error) because it takes less time.
for example, if we compared MSE with RMSE, Root Mean Squared Error it takes more time because it is squaring the MSE value so it takes more time while compilation.

FORMULAE FOR LINEAR REGRESSION IS 
                                                            "Y=MX+C"
For code, part visit my GitHubclick here








Comments

Popular posts from this blog

SUPPORT VECTOR MACHINE

                 SUPPORT VECTOR MACHINE:- Support vector machine:-it is a type of supervised learning algorithm it is used to solve both classification and regression problem. Note :- It is mostly used for classification problems. what we are going to learn in SVM: a) Support vectors b) Hyperplane c) Marginal Distance d) Linear Separable e) Non-linear separable f) support kernels NOw we will discuss everything in detail. Hyper plane:- in the above diagram, we have drawn three lines(A, B, C) separating two data points (stars and reds) The lines (A, B, C) are called Hyperplanes. Note:- “Select the hyper-plane which segregates the two classes better” i.e  above there are three hyperplanes how to select the best hyperplane? b)Marginal Distance:- When we draw a hyperplane the plane creates two new(------) dotted lines one line above the hyperplane and one line below the hyperplane line. see the below image you will get an ...

KNN Interview Questions

                           KNN interview questions 1) Which of the following distance metric can not be used in k-NN? A) Euclidean Distance B) Manhatten Distance c) Hamming Distance E) Minkowski Distance F) Jaccard Distance G) All the above Answer:- G All of these distance metric can be used as a distance metric for KNN 2)Knn is for regression or classification? Answer:- Knn is used for both classification and regression problems. 3) When we use Manhatten Distance? Answer:-Manhatten distance is used for continuous variables. 4) You have given the following 2 statements, find which of these options is/are true in case of k-NN? In the case of very large value of k , we may include points from other classes into the neighborhood, so it leads to overfitting. In case of too small value of k the algorithm is very sensitive to noise.(it will affect our model performance). Answer:-The above two points are answers. 5...

K-NN

                           K-Nearest Neighbour The k-nearest neighbors (KNN) algorithm is a simple, easy-to-implement supervised machine learning algorithm that can be used to solve both classification and regression problems. KNN means in short Similar things near to each other. The KNN algorithm uses ‘ feature similarity ’ to predict the values of any new data points. I am going to explain this knn with a simple example:- In the above table, we have S.No, Height, Weight & Age in our table for S.No.5 the weight is missing, So now we need to predict the weight of the person based on his Height and Age. graph example in the above graph, X_axis represents the age and the y_axis represents the Height of a person. in the above graph, I write 5 numbers, in that  4 values have output and one id not having output now see How KNN help us. the 5th number I want to predict which is circled. hint:-By seeing th...