Lets start coding for linear regression
As from previous post, linear regression has analytical solution. For a given dataset the optimization problem reduces to linear algebra psudeo-inverse problem. ``` W = (XX')^-1XY``` This would be the training step for the algorithm. Python code would be very easy. np.linalg.inv(X.dot(X.T)).dot(X).dot(Y) Later once the parameters W is defined runtime would be a single matrix multiplication as our linear model. Y' = WX Could be written as Y_est = W.dot(X)
Comments
Post a Comment