Skip to content

Instantly share code, notes, and snippets.

@nusco
Created April 17, 2020 13:47
Show Gist options
  • Save nusco/ddf34e5721cded8ceb4d6c541869f75a to your computer and use it in GitHub Desktop.
Save nusco/ddf34e5721cded8ceb4d6c541869f75a to your computer and use it in GitHub Desktop.
From "Programming Machine Learning": gradient calculation with multiple input variables
# The gradient with multile input variables
def gradient(X, Y, w):
return 2 * np.matmul(X.T, (predict(X, w) - Y)) / X.shape[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment