I'm trying to calculate the math behind the code:
import tensorflow as tf
import numpy as np
y_pred_one_hot = np.array([0, 0, 0, 1], dtype='float32')
y_true_one_hot = np.array([0, 1, 0, 0], dtype='float32')
res = tf.keras.losses.categorical_crossentropy(y_true_one_hot,y_pred_one_hot,from_logits=False)
round(res.numpy() , 3)
gives = 16.118
I'm using the equation:
- log(0) is error ? so how I'm getting 16 ?
- ti and pi have 0 in same indexes, so the sum doesn't need be 0 ?
what am I missing behaind the math ?
