Commit 1e54508c authored by Dahua Lin's avatar Dahua Lin

Fix the binomial entropy bug (fix #195)

There did exist a bug in the code. The computation was off by 1 in a factor.
parent cca24312
......@@ -30,7 +30,7 @@ function entropy(d::Binomial; approx::Bool=false)
lp = n * log(p0)
s = exp(lp) * lp
for k = 1:n
lp += log((n - k) / (k + 1)) + lg
lp += log((n - k + 1) / k) + lg
s += exp(lp) * lp
end
return -s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment