Imagine you have an online shop and you have launched various promotions several times to attract customers.
To calculate the number of purchases depending on the number of visitors in the future, you want to build a linear regression model:
Find the value of the coefficient of the target dependency using the least squares method and the data below.
| Number of visitors | Number of purchases |
| 4 | 1 |
| 6 | 5 |
| 8 | 8 |
| 10 | 10 |
| 12 | 15 |
Input values as NumPy arrays
import numpy as np
x = np.array([4, 6, 8, 10, 12])
y = np.array([1, 5, 8, 10, 15])