Skip to content

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)

Notifications You must be signed in to change notification settings

cbueth/infomeasure-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, 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
  • 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:

[dependencies]
infomeasure = "0.1.0"

Usage Examples

Calculating Entropy with Gaussian Kernel

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:

cargo test

Benchmarks

Performance benchmarks are available for different estimation methods:

cargo bench

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

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)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published