Regression

Raghul Prasanth
1 min readJul 3, 2021

Regression: This is Supervised Machine Learning. The output variable to be predicted is a continuous/numerical variable.

E.x:

Predict the score of students based on their 10th std marks, 12th std marks etc

The predictor variable is also known as the independent variable. And the output variables are also known as the dependent variable.

Types of Regression:

1. Simple Linear Regression — with only 1 predictor/independent variable

2. Multiple Linear Regression — with more than 1 predictor/independent variable

To understand how Regression works:

Let’s take previous years data of Marketing Amount data and Sales Amount data and build the model and then predict it.

First you want to see if any relationship between these 2 (Marketing Amount data and Sales Amount data)?

How to see relationship between data points? Have you heard about Scatterplots?

Scatterplots are one of the most commonly used visualisation in the field of machine learning. They will reveal relationships between the data points and you can deduce some sort of trends in the data.

Plot Scatter Plot with below:

X axis — Marketing Amount data(independent variable) &

Y axis — Sales Amount data (dependent variable)

#Import Library
import scipy.stats as stats

#Plot the scatter plot
sns.jointplot(inp1.marketing, inp1.Sales, stat_func = stats.pearsonr )

Scatter Plot might give you a straight line for the above data.

A simple linear regression model will explain the relationship between a dependent and an independent variable using a straight line.

In next blog, we will see more details on simple linear regression?!

Previous Blog: Supervised & Unsupervised Machine Learning https://raghulprasanthpsg.medium.com/supervised-and-unsupervised-machine-learning-5e7e3333a307

--

--