Finding coefficient b

Report a typo

Imagine you have an online shop and you have launched various promotions several times to attract customers.

To calculate the number of purchases yy depending on the number of visitors xx in the future, you want to build a linear regression model:

y=ax+by=ax+b

Find the value of the coefficient bb 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])

Enter a number
___

Create a free account to access the full topic