Utility Functions
DiscreteEntropy.logx — Functionlogx(x)::Float64Returns 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.
DiscreteEntropy.xlogx — Functionxlogx(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.
DiscreteEntropy.to_bits — Functionto_bits(x::Float64)Return $\frac{h}{\log(2)}$ where h is in nats
DiscreteEntropy.to_bans — Functionto_bans(x::Float64)Return $\frac{h}{log(10)}$ where h is in nats
DiscreteEntropy.marginal_counts — Functionmarginal_counts(contingency_matrix::Matrix, dim; normalise=false)Return the marginal counts of contingency_matrix along dimension dim.
If normalised = true, return as probability distribution.
DiscreteEntropy.bins — Functionbins(x::CountData)Return the bins (top row) of x.multiplicities
DiscreteEntropy.multiplicities — Functionbins(x::CountData)Return the bin multiplicities (bottom row) of x.multiplicities
DiscreteEntropy.from_csv — Functionfrom_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.
Non-exported functions
DiscreteEntropy.xFx — Function 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.
DiscreteEntropy.gammalndiff — Function gammalndiff(x::Float64, dx::Float64)Return $\log \Gamma(x + δx) - \log Γ(x)$