Skip to content

Instantly share code, notes, and snippets.

@michaelChein
Created February 11, 2019 19:55
Show Gist options
  • Save michaelChein/929b6f35f11b35001089cf3989cf6472 to your computer and use it in GitHub Desktop.
Save michaelChein/929b6f35f11b35001089cf3989cf6472 to your computer and use it in GitHub Desktop.
recursion pseudocode for backprop article
def backprop(current_layer=1):
if current_layer is output_layer:
∂_L = current_layer - labels
current_layer.∆w = ∂_L * g'(Z(current_layer.nodes)) * (current_layer-1).nodes
return ∂_L
else:
∂_L = backprop(current_layer+1)
∂_L = ∂_L * g'(Z((current_layer+1).nodes)) * (current_layer+1).W
current_layer.∆w = ∂_L * g'(Z(current_layer.nodes)) * (current_layer-1).nodes
return ∂_L
layers.W += layers.∆w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment