https://github.com/cbueth/infomeasure-rs
Rust library for calculating various information-theoretic measures, including entropy, mutual information, transfer entropy, and more, with support for both discrete and continuous variables. (WIP)
https://github.com/cbueth/infomeasure-rs
Last synced: 9 months ago
JSON representation
Rust library for calculating various information-theoretic measures, including entropy, mutual information, transfer entropy, and more, with support for both discrete and continuous variables. (WIP)
- Host: GitHub
- URL: https://github.com/cbueth/infomeasure-rs
- Owner: cbueth
- Created: 2025-07-13T12:07:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-19T20:59:14.000Z (11 months ago)
- Last Synced: 2025-09-09T23:25:41.856Z (9 months ago)
- Language: Rust
- Size: 75.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# infomeasure-rs
`infomeasure` is a Rust library for computing information-theoretic measures such as entropy, mutual information, and transfer entropy. This project is a Rust implementation of the [infomeasure](https://github.com/cbueth/infomeasure), designed to provide superior performance while maintaining API compatibility.
> [!IMPORTANT]
> This crate is under development, features will be added step by step.
## Features
- **Multiple Estimation Techniques**: Supports discrete and kernel-based approaches
- **Future**: all features from the parent pacakge, see [infomeasure introduction](https://infomeasure.readthedocs.io/en/latest/guide/introduction/)
- **High Performance**: Leverages Rust's zero-cost abstractions for efficient computation
- **Python Compatibility**: Designed to potentially serve as a backend for the Python package
- **Modular Design**: Easily extensible architecture for adding new estimators and methods
## Installation
> [!NOTE]
> As of now infomeasure is not on crates.io, yet.
Add this to your `Cargo.toml`:
```toml
[dependencies]
infomeasure = "0.1.0"
```
## Usage Examples
### Calculating Entropy with Gaussian Kernel
```rust
use infomeasure::estimators::entropy::Entropy;
use ndarray::Array2;
fn main() {
// Create or load your data
let data = Array2::from_shape_vec((1000, 2), vec![/* your data */]).unwrap();
// Calculate entropy with Gaussian kernel
let bandwidth = 0.5;
let entropy = Entropy::nd_kernel_with_type::<2>(
data.clone(),
"gaussian".to_string(),
bandwidth
).global_value();
println!("Entropy: {}", entropy);
}
```
## Repository Structure
- `src/` - Main source code
- `estimators/` - Estimation techniques implementations
- `approaches/` - Specific implementations (discrete, kernel, ...)
- `traits/` - Shared interfaces for estimators
- `benches/` - Performance benchmarks using Criterion
- `tests/` - Unit and integration tests
- `examples/` - Example usage and demonstrations
## Testing and Validation
The project includes a validation crate that compares results with the Python implementation to ensure compatibility and correctness. Run tests with:
```bash
cargo test
```
## Benchmarks
Performance benchmarks are available for different estimation methods:
```bash
cargo bench
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.