Hello @awidianto,
- mathematically, \lim_{p \to 0} p\log(p) = 0
- computationally, we cannot calculate
0log(0)
becauselog(0)
isinf
, so usually we add a very small number like10e-7
to inside thelog
so that we are instead calculating0 * log(0+10e-7)
which will also gives you a 0. - if we don’t add that small constant, we can use the if-else statement.
Cheers,
Raymond