Why is the weight an array and the intercept a number?

There surely is a reason, but it’s not obvious from outside

A linear model is defined as:

y = intercept + coef[0] * x[0] + coef[1] * x[1] + ... + coef[n] * x[n]

Thus there is a single intercept but one coefficient by feature. We can pack all coefficients together and use a matrix multiplication and adding the intercept to get the predicted target.

1 Like

Of course… Thank you