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