Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Last active April 12, 2020 21:28
Show Gist options
  • Save SkalskiP/427b3188c8501d31b4d4024b923b6cd4 to your computer and use it in GitHub Desktop.
Save SkalskiP/427b3188c8501d31b4d4024b923b6cd4 to your computer and use it in GitHub Desktop.
Updating parameter values
def update(params_values, grads_values, nn_architecture, learning_rate):
for layer_idx, layer in enumerate(nn_architecture):
params_values["W" + str(layer_idx)] -= learning_rate * grads_values["dW" + str(layer_idx)]
params_values["b" + str(layer_idx)] -= learning_rate * grads_values["db" + str(layer_idx)]
return params_values;
@bobbyscharmann
Copy link

This Gist, in the context of https://towardsdatascience.com/lets-code-a-neural-network-in-plain-numpy-ae7e74410795, should be changed to enumerate(nn_architecture, 1) to skip the first index (index 0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment