infomeasure-rs
High-performance Rust library for information-theoretic measures with multiple estimation approaches.
What This Does
infomeasure-rs computes entropy, mutual information, and transfer entropy from data using four different estimation strategies:
- Discrete: For categorical data with 11+ bias-corrected estimators
- Kernel: For continuous data with optional GPU acceleration
- Ordinal: For time series using permutation patterns
- Exponential Family: For high-dimensional data using k-NN
Installation
[]
= "0.1.0"
Optional Features
Enable GPU acceleration for large datasets:
= { = "0.1.0", = ["gpu"] }
Enable fast exponential approximations:
= { = "0.1.0", = ["fast_exp"] }
use Entropy;
use array;
// Discrete entropy
let data = array!;
let entropy = new_discrete.global_value;
println!;
// Continuous data with kernel estimation
let continuous = array!;
let kernel_entropy = .global_value;
println!;
Feature Status
| Feature | Discrete | Kernel | Ordinal | k-NN |
|---|---|---|---|---|
| Entropy | ✅ | ✅ | ✅ | ✅ |
| Mutual Information | ✅ | ✅ | 🔄 | 🔄 |
| Transfer Entropy | ✅ | ✅ | 🔄 | 🔄 |
✅ = Available | 🔄 = In Development | ❌ = Planned
Documentation
- API Reference - Complete documentation
- Examples - Usage examples
Advanced Features
GPU Acceleration
Enable GPU computation for large datasets:
= { = "0.1.0", = ["gpu"] }
Performance Optimizations
Fast exponential approximations:
= { = "0.1.0", = ["fast_exp"] }
Python Compatibility
This crate maintains API compatibility with the infomeasure Python package while providing 10-100x performance improvements.
Repository Structure
src/- Main source codeestimators/- Estimation techniques implementationsapproaches/- Specific implementations (discrete, kernel, ...)traits/- Shared interfaces for estimators
benches/- Performance benchmarks using Criteriontests/- Unit and integration testsexamples/- Example usage and demonstrations
Development Setup
Prerequisites
- Rust 1.70+ (for building)
- uv Python package manager (for validation tests)
Python Environment Setup
The validation tests require a Python environment with infomeasure package.
Set it up once before running tests:
# Create virtual environment in validation crate directory
# Install dependencies
Running Tests
# Run all tests (includes Python validation)
# Run only Rust unit tests (skip Python validation)
Testing and Validation
The project includes a validation crate that compares results with Python implementation to ensure compatibility and correctness.
Benchmarks
Performance benchmarks are available for different estimation methods:
Contributing
Contributions welcome! Please feel free to submit a Pull Request.
License
MIT OR Apache-2.0