1 - Using A = np.array([x1,x2,x3]) worked to fix the error in How I plot the linear regression.
So I decided increase the number of elements in x1,x2 and x3 and continue to use example in How I plot the linear regression, and now I get the error "ValueError: too many values to unpack". Numpy can't calculate with so many numbers?
>>> x1 = np.array([3,2,2,3,4,5,6,7,8])
>>> x2 = np.array([2,1,4.2,1,1.5,2.3,3,6,9])
>>> x3 = np.array([6,5,8,9,7,0,1,2,1])
>>> y = np.random.random(3)
>>> A = np.array([x1,x2,x3])
>>> m,c = np.linalg.lstsq(A,y)[0]
Traceback (most recent call last):
File "testNumpy.py", line 18, in <module>
m,c = np.linalg.lstsq(A,y)[0]
ValueError: too many values to unpack
2 - I also compared my version with the one defined in Multiple linear regression with python. Which one is correct? Why they use the transpose in this example?
Thanks,