Machine Learning - Linear Regression

Regression

The word regression is used when trying to find a relationship between variables.

In machine learning, and mathematical comparisons, those relationships are used to predict the outcome of future events.

Linear Regression

Line rotation uses relationships between data points to draw a straight line across.

This line can be used to predict future values.

In machine learning, predicting the future is very important.

How Does it Work?

Python has a way of finding the relationship between data points and drawing a linear regression. We will show you how to use these methods instead of using a mathematical formula.

In the example below, x-axis represents age, and y axis represents speed. We have registered the age and speed of 13 vehicles as they pass the tollbooth. Let's see if the data we collect can be used to move a queue:

Example
import matplotlib.pyplot as plt

x = [5,7,8,7,2,17,2,9,4,11,12,9,6]
y = [99,86,87,88,111,86,103,87,94,78,77,85,86]

plt.scatter(x, y)
plt.show()