Last active
November 10, 2019 11:03
-
-
Save RafayAK/85c6e3dbead1c57a013f118e7534dcd4 to your computer and use it in GitHub Desktop.
training loop for iris data
This file contains 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
costs = [] # initially empty list, this will store all the costs after a certain number of epochs | |
# Start training | |
for epoch in range(number_of_epochs): | |
# ------------------------- forward-prop ------------------------- | |
Z1.forward(X_train) | |
A1.forward(Z1.Z) | |
# ---------------------- Compute Cost ---------------------------- | |
cost, dZ1 = compute_stable_bce_cost(Y_train, Z1.Z) | |
# print and store Costs every 100 iterations and of the last iteration. | |
if (epoch % 100) == 0 or epoch == number_of_epochs - 1: | |
print("Cost at epoch#{}: {}".format(epoch, cost)) | |
costs.append(cost) | |
# ------------------------- back-prop ---------------------------- | |
Z1.backward(dZ1) | |
# ----------------------- Update weights and bias ---------------- | |
Z1.update_params(learning_rate=learning_rate) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment