From what I've been reading, if there is no underlying difference between the 2 probabilities distributions we would have perfect entropy.
I'm putting an example below. Can anybody explain why the cross entropy of two exactly equal probability distributions is not 0 here?
### example of calculating cross entropy for identical distributions
from math import log2
### calculate cross-entropy
def cross_entropy(p, q):
return -sum([p[i]*log2(q[i]) for i in range(len(p))])
### define data
p = [0.10, 0.40, 0.50]
# calculate cross entropy H(P, P)
ce_pp = cross_entropy(p, p)
print('H(P, P): %.3f bits' % ce_pp)
Result = 1.36
p[i]*log2(p[i])
? $\endgroup$