PS what's the R code? sorry if I am missing something basic.
On Sun, Jun 1, 2008 at 8:32 PM, Ted Dunning <[EMAIL PROTECTED]> wrote:
> The R code is instructive here. Everywhere you are about to take the log of
> a zero probability, you should add 1. This is equivalent to saying that
>
> lim_{x -> 0} x log x = 0
OK true but...
> One easy way to do this is to wrap your log function:
>
> safeLog = {x -> return (x==0)?0:Math.log(x)}
... log(x) approaches -infinity as x approaches 0 so why is 0 a good
substitute for log(0)?
But I would buy that, for purposes of this function, "log(p)" can be
replaced with "log(p+1)" so at least the output value is >= 0 and less
than 1?