| Crates.io | infomeasure |
| lib.rs | infomeasure |
| version | 0.1.0-alpha.1 |
| created_at | 2026-01-17 22:54:49.159044+00 |
| updated_at | 2026-01-17 22:54:49.159044+00 |
| description | Information theory measures and entropy calculations for Rust |
| homepage | https://docs.rs/infomeasure |
| repository | https://codeberg.org/cbueth/infomeasure-rs |
| max_upload_size | |
| id | 2051371 |
| size | 751,427 |
High-performance Rust library for information-theoretic measures with multiple estimation approaches.
infomeasure-rs computes entropy, mutual information, and transfer entropy from data using four different estimation strategies:
[dependencies]
infomeasure = "0.1.0"
Enable GPU acceleration for large datasets:
infomeasure = { version = "0.1.0", features = ["gpu"] }
Enable fast exponential approximations:
infomeasure = { version = "0.1.0", features = ["fast_exp"] }
use infomeasure::estimators::entropy::Entropy;
use ndarray::array;
// Discrete entropy
let data = array!(1, 2, 1, 3, 2, 1);
let entropy = Entropy::new_discrete(data).global_value();
println!("Entropy: {}", entropy);
// Continuous data with kernel estimation
let continuous = array![[1.0, 1.5], [2.0, 3.0], [4.0, 5.0]];
let kernel_entropy = Entropy::nd_kernel::<2>(continuous, 1.0).global_value();
println!("Kernel entropy: {}", kernel_entropy);
| Feature | Discrete | Kernel | Ordinal | k-NN |
|---|---|---|---|---|
| Entropy | ✅ | ✅ | ✅ | ✅ |
| Mutual Information | ✅ | ✅ | 🔄 | 🔄 |
| Transfer Entropy | ✅ | ✅ | 🔄 | 🔄 |
✅ = Available | 🔄 = In Development | ❌ = Planned
Enable GPU computation for large datasets:
infomeasure = { version = "0.1.0", features = ["gpu"] }
Fast exponential approximations:
infomeasure = { version = "0.1.0", features = ["fast_exp"] }
This crate maintains API compatibility with the infomeasure Python package while providing 10-100x performance improvements.
src/ - Main source code
estimators/ - Estimation techniques implementations
approaches/ - Specific implementations (discrete, kernel, ...)traits/ - Shared interfaces for estimatorsbenches/ - Performance benchmarks using Criteriontests/ - Unit and integration testsexamples/ - Example usage and demonstrationsThe validation tests require a Python environment with infomeasure package.
Set it up once before running tests:
# Create virtual environment in validation crate directory
cd tests/validation_crate
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txt
# Run all tests (includes Python validation)
cargo test
# Run only Rust unit tests (skip Python validation)
cargo test --lib
The project includes a validation crate that compares results with Python implementation to ensure compatibility and correctness.
Performance benchmarks are available for different estimation methods:
cargo bench
Contributions welcome! Please feel free to submit a Pull Request.
MIT OR Apache-2.0