Last active
October 11, 2020 11:07
-
-
Save PyDataBlog/815b9d217e8888ec919d12f8d70d77a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Update the paramaters of the model using the gradients (∇) | |
| and the learning rate (η). | |
| """ | |
| function update_model_weights(parameters, ∇, η) | |
| L = Int(length(parameters) / 2) | |
| # Update the parameters (weights and biases) for all the layers | |
| for l = 0: (L-1) | |
| parameters[string("W_", (l + 1))] -= η .* ∇[string("∂W_", (l + 1))] | |
| parameters[string("b_", (l + 1))] -= η .* ∇[string("∂b_", (l + 1))] | |
| end | |
| return parameters | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment