daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def exact_linear_reg_solution(X, y, C=0):
  2.     return np.linalg.inv(X.T.dot(X) + C * np.identity(n=X.shape[1])).dot(X.T).dot(y)
  3.  
  4. def linear_reg_loss(X, y, w, C=0):
  5.     return np.linalg.norm(X.dot(w) - y) ** 2 + C * (np.linalg.norm(w) ** 2)
RAW Paste Data
Top