Compute Statistical Measures of Divergence
Project description
Divergence
Divergence is a Python package to compute statistical measures of entropy and divergence from probability distributions and samples.
The following functionality is provided:
- (Information) Entropy
- Cross Entropy
- Relative Entropy or Kullback-Leibler Divergence
- Jensen-Shannon Divergence
The units in which these entropy and divergence measures are calculated can be specified by the user.
This is achieved by the argument log_fun
, which accepts a function that calculates the logarithm with respect to a particular base.
The following units can be realized by the corresponding choice of the argument log_fun
in the entropy and divergence calculation functions:
- bits: base 2 via
np.log2
- nats: base e via
np.log
- dits: base 10 via
np.log10
In a Bayesian context, relative entropy can be used as a measure of the information gained by moving
from a prior distribution q
to a posterior distribution p
.
Installation
pip install divergence
Examples
See the Jupyter notebook Divergence.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for divergence-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504c0ad5b5b3423915f4900f057da560bcab40b170a953352df2ebade6594517 |
|
MD5 | de7706acc7ac01125879a2bf8f7c83c3 |
|
BLAKE2b-256 | bffcf43b3a23e1f160155806b26b339099ffff20a2a3ce57b36d09d809b833df |