skbio.math.diversity.alpha.shannon

skbio.math.diversity.alpha.shannon(counts, base=2)[source]

Calculate Shannon entropy of counts (H), default in bits.

Parameters:

counts : 1-D array_like, int

Vector of counts.

base : scalar, optional

Logarithm base to use in the calculations.

Returns:

double

Shannon diversity index H.

Notes

The implementation here is based on the description given in the SDR-IV online manual [R54], except that the default logarithm base used here is 2 instead of \(e\).

References

[R54](1, 2) http://www.pisces-conservation.com/sdrhelp/index.html