Estimators of mutual information and distributions used to benchmark them.
Project description
Benchmarking Mutual Information
BMI is the package for estimation of mutual information between continuous random variables and testing new estimators.
- Documentation: https://cbg-ethz.github.io/bmi/
- Source code: https://github.com/cbg-ethz/bmi
- Bug reports: https://github.com/cbg-ethz/bmi/issues
- PyPI package: https://pypi.org/project/benchmark-mi
Getting started
While we recommend taking a look at the documentation to learn about full package capabilities, below we present the main capabilities of the Python package. (Note that BMI can also be used to test non-Python mutual information estimators.)
You can install the package using:
$ pip install benchmark-mi
Alternatively, you can use the development version from source using:
$ pip install "bmi @ https://github.com/cbg-ethz/bmi"
Note: BMI uses JAX and by default installs the CPU version of it. If you have a device supporting CUDA, you can install the CUDA version of JAX.
Now let's take one of the predefined distributions included in the benchmark (named "tasks") and sample 1,000 data points. Then, we will run two estimators on this task.
import bmi
task = bmi.benchmark.BENCHMARK_TASKS['multinormal-dense-2-5-0.5']
print(f"Task {task.name} with dimensions {task.dim_x} and {task.dim_y}")
print(f"Ground truth mutual information: {task.mutual_information():.2f}")
X, Y = task.sample(1000, seed=42)
cca = bmi.estimators.CCAMutualInformationEstimator()
print(f"Estimate by CCA: {cca.estimate(X, Y):.2f}")
ksg = bmi.estimators.KSGEnsembleFirstEstimator(neighborhoods=(5,))
print(f"Estimate by KSG: {ksg.estimate(X, Y):.2f}")
Citing
If you find this code useful in your research, consider citing our manuscript:
@misc{beyond_normal2023,
title={Beyond Normal: On the Evaluation of Mutual Information Estimators},
author={Paweł Czyż and Frederic Grabowski and Julia E. Vogt and Niko Beerenwinkel and Alexander Marx},
year={2023},
eprint={2306.11078},
archivePrefix={arXiv},
primaryClass={stat.ML}
}
Project details
Release history Release notifications | RSS feed
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 benchmark_mi-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46618239bfd1b5aeec6d2d805a755f9decd5c93ba52b91035288c0a13a462c16 |
|
MD5 | 3cbc7cef9863443c88ef4d338034cab5 |
|
BLAKE2b-256 | da717b9388b48aa5f241538b4db21da62d58800edef813f9e3085f8f45c20d4f |