Skip to content

Instantly share code, notes, and snippets.

@nusco
Created April 17, 2020 13:47
Show Gist options
  • Select an option

  • Save nusco/ddf34e5721cded8ceb4d6c541869f75a to your computer and use it in GitHub Desktop.

Select an option

Save nusco/ddf34e5721cded8ceb4d6c541869f75a to your computer and use it in GitHub Desktop.

Revisions

  1. nusco created this gist Apr 17, 2020.
    3 changes: 3 additions & 0 deletions gradient_multiple_variables.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # The gradient with multile input variables
    def gradient(X, Y, w):
    return 2 * np.matmul(X.T, (predict(X, w) - Y)) / X.shape[0]