Shannon wavelet entropy


I look for a function similar to the wentropy function in the Wavelet Toolbox of Matlab. In an older code I used to following form:

H = -wentropy( DataArray , 'shannon' );

I look in several packages (Wavelet.jl, WaveletsExt.jl, Entropies.jl), finally in ComplexityMeasures.jl and found a similar approach (ComplexityMeasures.Shannon) but no example that I can understand how to use the function.

Does anyone know an approach to implement the Matlab function in Julia?

Kind regards,



I think you want the entropy() function in ComplexityMeasures, using the Shannon measure. The relevant documentation is around here.


thanks for the hint, I checked it and it works well for time series ( H = entropy(WaveletOverlap(), DATA) ) , what I need is this for 2D (image) data. One approach could be to calculate it line by line, but this is very slow. Is there a faster implementation available. I looked in SpatialDispersion and SpatialOrdinalPatterns but stencil parameters seems to be not senseful in my case.


I don’t know enough about your problem to say how it should map to the SpatialDispersion calculation.

Having a look at wentropy in Matlab tells me they’re doing something substantially less sophisticated than ComplexityMeasures.jl: they compute the probability distribution of the input pixels (with bins depending on pixel type) and then returning -sum(p.*log2(p)). This is considerably simpler than what I steered you toward.

The way to match Matlab’s wentropy is to start with StatsBase.Histogram, choosing the normalization. The rest should be trivial.