Linear Regression in Machine Learning

Linear Regression is one of the most basic techniques of predictive analytics in machine learning and statistical mathematics. It is based on the basic statistical technique of finding relationships between the dependent and the independent variables in a mathematical equation. This is used to develop linear models for predictive modeling in machine learning.

Photo by energepic.com from Pexels

This regression technique is entirely a mathematical approach that deals with a linear relationship between the dependent and the independent variables. It is ideally used in various applications in the domain of data science, machine learning, and Artificial Intelligence. It serves as the basis for a linear model in machine learning.

A linear model is preferable in the cases where the dataset has more number of columns than rows. It is also a much faster way for training the data than its non-linear counterparts. Its analysis works as a means to solve many problems in statistics as well as predicting new values in machine learning.

It can also be used to predict the future outcomes by observing the trends in the dataset. Linear Regression has two types

  • Simple Linear Regression
  • Multiple Linear Regression

Also a regression model can be chosen by observing the dataset size involved in the application.

Here in the equations below, the predictor variables are known as predictors or more commonly as X. X are also called the input variables and Y is the output variable of the expression.

Simple Linear Regression

Basic Equation :

Y=mX+c

the extra term in the expression is known as the bias term or the error term. Here ‘m’ is the coefficient. It uses a single input. It is not ideally used in many applications. It can be used to find correlations in the dataset available. Correlations help in predicting the outcome of a new input.

Multiple Linear Regression

Basic Equation :

Y=m0X0+m1X1+……..mnXn+c

This regression technique is used in various tasks such as regression analysis. Multiple linear regression has multiple predictors but a single output or an outcome. The dependence of variables can be clearly seen by using interactive graphs. They can be plotted in python programming using libraries such as the matplotlib and pyplot among many others.

A penalized linear regression model can be used to regularize this technique of regression where many variables are present. The error term is also penalized in this type of linear regression technique. Some of the penalized linear regressions are ridge regression, lasso regression and elastic net regression. It is used whenever the parameters or the data has too many variables.

Implementing in Python

It can be implemented in python programs by importing specific packages in numerous libraries such as Scikit learn. Example :

>>>from klearn.linear_model import LinearRegression

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *