That function was given to you in the template code. It is at the end of the two_layer_model cell:
# Print the cost every 100 iterations and for the last iteration
if print_cost and (i % 100 == 0 or i == num_iterations - 1):
print("Cost after iteration {}: {}".format(i, np.squeeze(cost)))
if i % 100 == 0:
costs.append(cost)
return parameters, costs
def plot_costs(costs, learning_rate=0.0075):
plt.plot(np.squeeze(costs))
plt.ylabel('cost')
plt.xlabel('iterations (per hundreds)')
plt.title("Learning rate =" + str(learning_rate))
plt.show()
You must have accidentally deleted it. If you don’t believe me, get a clean copy and compare for yourself.