Linear regression : ValueError: operands could not be broadcast together with shapes (3,) (1338,)
It looks like you're trying to multiply a matrix and a vector point-wise. Such an operation is not defined. I think you should use X.dot(w), where X is a feature $\bf matrix$ and w is the wights $\bf vector$. np.dot can operate with objects of different nature (like matrices and vectors). So in h I'd write return X.dot(w). Also, I'd call it only with a matrix X (for consistency), even if there's an object it would be $X \in \mathbb{R}^{1 \times d}$ in that case. Watch carefully after shapes of the objects which enter functions.