theta=np.linalg.inv(x.T.dot(x)).dot(x.T).dot(y) np.linalg.inv 求矩阵的逆矩阵 x.T求矩阵的转置矩阵 .dot()矩阵相乘 解析解的形式θ = (x逆矩乘x)矩乘x逆矩乘y