December 2018
Beginner to intermediate
684 pages
21h 9m
English
The final piece is the cost function to evaluate the neural network output based on the given label. The cost function, J, uses the cross-entropy loss, ξ, which sums the deviations of the predictions for each class, C, from the actual outcome, as follows:

It takes the following form in Python:
def loss(y_hat, y_true): """Cross-entropy""" return - (y_true * np.log(y_hat)).sum()
Read now
Unlock full access