Linear Regression - intro

 Linear Regression:

Linear regression is one of the easiest and most popular Machine learning algorithm. It is statistical method that is used for predictive analysis. Linear regression makes predictions for continuous/real or numeric variables such as sales, salary, age, product, price and etc.,

Linear Regression algorithm shows a linear relationship between a dependent variable (Y) and one or more independent variables (X), hence called as linear regression. Since, linear regression shows the linear relationship, which means it finds how the value of the dependent variable is changing according to the value of the independent variable.

The Linear regression model provides a sloped straight line representing the relationship between the variables.


Mathematically we can represent a linear regression as:

Y = B๊ง+B₁ X+ ๐œ€

Here,

  •  Y = Dependent variable ( Target Variable ).
  • X = Independent variable (predictor variable)
  • B๊ง = Intercept of the line 
  •  B₁ = Linear regression co-efficient (slope)
  •  ๐œ€ = Random error.
The values for X and Y variables are training datasets for Linear regression model representation.

Types of Linear Regression:

Linear regression can be further divided into two types of algorithms

Simple Linear regression:
If a single independent variable is used to predict the value of a numerical dependent variable, then such a Linear regression algorithm is called simple linear regression.

Multiple Linear Regression:
If  more than one independent  variables are used to predict the value  of a numerical dependent variable, then such a Linear regression algorithm is called Multiple linear regression.

Linear Regression Line:
A linear line showing the relationship between the dependent and independent variables is called a regression line. A regression line can show two types of relationship : Positive and Negative.
 
Positive  Linear Relationship:
If the dependent variable increases on the Y-axis and the independent variable increases on the X- axis, then such a relationship is termed as a positive linear relationship.

here, X is directly proportional to Y 

                  ⇒   X ๐ฐ Y



Negative Linear Relationship:

If the dependent variable decreases on the Y- axis and independent variable increases on the X- axis, then such relationship is called as  a negative linear relationship.

here, X is indirectly proportional to Y

               ⇒     X  ๐ฐ  1/Y




Finding the best fit line:

When working with linear regression, our main goal is to find the best fit line that means the error between predicted values and actual values should be minimized. The best fit line have the least error.



Comments