Utility Functions

DiscreteEntropy.logxFunction
logx(x)::Float64

Returns natural logarithm of x, or 0.0 if x is zero

Setting logx(0) to 0 is a standard trick used when estimating entropy in order to avoid infinities when calculating the average surprisal.

source
DiscreteEntropy.xlogxFunction
xlogx(x::Float64)

Returns x * log(x) for x > 0, or 0.0 if x is zero

Setting xlogx(0) to 0 is a standard trick used when estimating entropy in order to avoid infinities when calculating the average surprisal.

source
DiscreteEntropy.marginal_countsFunction
marginal_counts(contingency_matrix::Matrix, dim; normalise=false)

Return the marginal counts of contingency_matrix along dimension dim.

If normalised = true, return as probability distribution.

source
DiscreteEntropy.from_csvFunction
from_csv(file::String, field, ::Type{T}; remove_zeros=false, header=nothing, kw...) where {T<:EntropyData}

Simple wrapper around CSV.File() which returns a CountData object. For more complex requirements, it is best to call CSV directly.

source

Non-exported functions

DiscreteEntropy.xFxFunction
 xFx(f::Function, x)

Returns x * f(x) for x > 0, or 0.0 if x is zero

Setting xFx(0) to 0 is a standard trick used when estimating entropy in order to avoid infinities when calculating the average surprisal.

source