Linear Regression(Machine Learning)
The first & foremost algorithm which an ML/AI enthusiast goes through is Linear Regression. Linear Regression is an algorithm which performs a regression task & is based on Supervised Learning.
What is it?
From Statistical point of view, linear regression is a linear approach to model the relationship between a scalar response and one or more explanatory variables.
We extend this definition ahead in Machine Learning field, Here, Linear Model expresses relationship between one or more predictors & one Target variable.
The Target Variable is also known as dependent variable & Predictor variables can also be termed as Independent variables.
So, basically it’s the variations in independent variables which influences the Target Variable.
What it does?
Linear Regression model aims to find the Best Fit Line through the scatter plot of the given data points.
Best fit line is a straight line, so it satisfies the equation y=mx+c .
where,
y=Dependent variable.
m=Slope of the line.
x=Independent variable.
c=Intercept.
This equation is used a lot when we’re solving linear regression problems on paper.
Types
- Simple Linear Regression- Here, we aim to reveal the relationship between a single independent variable and a corresponding dependent variable or output.
- Multiple Linear Regression- Here, we aim to discover the relationship between two or more independent variables and the corresponding dependent variable or output. The independent variables can be either continuous or categorical.
Applications
- To determine the Relationship between drug dosage and blood pressure of patients.
- To evaluate trends in business.
- Predicting crop yields based on the amount of rainfall.
- Predicting the Salary of a person based on years of experience.
and many more….
Using Linear Model
Way 1- Directly importing from scikit learn library in Python.
Input- from sklearn.linear_model import LinearRegression
This imports the Linear Model.
Way 2- Implementing Linear Model from Scratch using NumPy, Pandas.
This was all about Linear Regression algorithm.
Happy Learning Folks!
You can also visit my previous blogs by clicking on their name below-
Follow me on LinkedIn- https://www.linkedin.com/in/imvat18/