Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Created October 11, 2018 19:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SkalskiP/5db61cc890b6a825506dd9081e814b05 to your computer and use it in GitHub Desktop.
Save SkalskiP/5db61cc890b6a825506dd9081e814b05 to your computer and use it in GitHub Desktop.
Putting things together
def train(X, Y, nn_architecture, epochs, learning_rate):
params_values = init_layers(nn_architecture, 2)
cost_history = []
accuracy_history = []
for i in range(epochs):
Y_hat, cashe = full_forward_propagation(X, params_values, nn_architecture)
cost = get_cost_value(Y_hat, Y)
cost_history.append(cost)
accuracy = get_accuracy_value(Y_hat, Y)
accuracy_history.append(accuracy)
grads_values = full_backward_propagation(Y_hat, Y, cashe, params_values, nn_architecture)
params_values = update(params_values, grads_values, nn_architecture, learning_rate)
return params_values, cost_history, accuracy_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment