Expand description
High-performance Rust library for information-theoretic measures including entropy, mutual information, and transfer entropy with multiple estimation approaches.
§Quick Start
use infomeasure::estimators::entropy::Entropy;
use infomeasure::estimators::traits::GlobalValue;
use ndarray::array;
// Discrete entropy
let data = array![1, 2, 1, 3, 2, 1];
let entropy = Entropy::new_discrete(data).global_value();
// Kernel entropy for continuous data
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();§Features
| Measure | Discrete | Kernel | Ordinal | Exp. Family | Notes |
|---|---|---|---|---|---|
| Entropy | ✅ | ✅ | ✅ | ✅ | All variants |
| Joint Entropy | ✅ | ✅ | ✅ | ✅ | Via multi-variable estimators |
| Conditional Entropy | ✅ | ✅ | ✅ | ✅ | |
| Cross-Entropy | ✅1 | ✅ | ✅ | ✅ | All approaches |
| KLD | ⚠️ | ⚠️ | ⚠️ | ⚠️ | Via cross-entropy |
| JSD | ❌ | ❌ | ❌ | ❌ | Planned |
| MI | ✅ | ✅ | ✅ | ✅ | All variants |
| CMI | ✅ | ✅ | ✅ | ✅ | Conditional MI |
| TE | ✅ | ✅ | ✅ | ✅ | Transfer Entropy |
| CTE | ✅ | ✅ | ✅ | ✅ | Conditional TE |
✅ = Implemented | ⚠️ = Available via trait | ❌ = Not implemented
§Estimation Approaches
§Discrete Estimation
Histogram-based probability estimation for categorical or binned data. Supports 11+ bias-corrected estimators (MLE, Miller-Madow, NSB, etc.).
§Kernel Estimation
Non-parametric density estimation for continuous data using Box and Gaussian kernels. Optional GPU acceleration for large datasets.
§Ordinal Pattern Analysis
Permutation pattern encoding for time series data, robust to amplitude variations.
§Exponential Family (k-NN)
Distance-based estimation using k-nearest neighbours for differential entropy. Supports Rényi and Tsallis generalized entropies.
§Architecture
The library follows a four-layer architecture:
- Public API Layer: Factory types (
Entropy,MutualInformation,TransferEntropy) - Estimation Approaches: Four independent strategies for different data types
- Core Infrastructure: Shared traits and data structures
- Performance Layer: Optional GPU acceleration and mathematical optimisations
§Feature Flags
gpu: Enable GPU acceleration for kernel estimatorsfast_exp: Use fast exponential approximations (trades accuracy for speed)
§Python Compatibility
This crate is designed to be a high-performance Rust backend for the infomeasure Python package, maintaining API parity while providing significant performance improvements.
§Guides
- Estimator Usage Guide - How to use this crate
- Estimator Selection Guide - Choosing the right estimator
For more details on the theory behind these measures, see the Python package documentation.
For discrete estimators, cross-entropy is only available for MLE, Miller-Madow, and Bayesian estimators. NSB, Chao-Shen, and Chao-Wang-Jost do not support cross-entropy due to theoretical inconsistencies in applying bias corrections to cross-entropy. ↩
Modules§
- estimators
- Information-theoretic estimators for entropy, mutual information, and transfer entropy.
- guide
- Information-Theoretic Measures Guide
Macros§
- new_
kernel_ cmi - Macro for creating a new
KernelConditionalMutualInformationestimator. - new_
kernel_ cte - Macro for creating a new
KernelConditionalTransferEntropyestimator. - new_
kernel_ mi - Macro for creating a new
KernelMutualInformationestimator. - new_
kernel_ te - Macro for creating a new
KernelTransferEntropyestimator. - new_
kl_ cmi - Macro for creating a new
KozachenkoLeonenkoConditionalMutualInformationestimator. - new_
kl_ cte - Macro for creating a new
KozachenkoLeonenkoConditionalTransferEntropyestimator. - new_
kl_ mi - Macro for creating a new
KozachenkoLeonenkoMutualInformationestimator. - new_
kl_ te - Macro for creating a new
KozachenkoLeonenkoTransferEntropyestimator. - new_
ksg_ cmi - Macro for creating a new
KsgConditionalMutualInformationestimator. - new_
ksg_ cte - Macro for creating a new
KsgConditionalTransferEntropyestimator. - new_
ksg_ mi - Macro for creating a new
KsgMutualInformationestimator. - new_
ksg_ te - Macro for creating a new
KsgTransferEntropyestimator. - new_
renyi_ cmi - Macro for creating a new
RenyiConditionalMutualInformationestimator. - new_
renyi_ cte - Macro for creating a new
RenyiConditionalTransferEntropyestimator. - new_
renyi_ mi - Macro for creating a new
RenyiMutualInformationestimator. - new_
renyi_ te - Macro for creating a new
RenyiTransferEntropyestimator. - new_
tsallis_ cmi - Macro for creating a new
TsallisConditionalMutualInformationestimator. - new_
tsallis_ cte - Macro for creating a new
TsallisConditionalTransferEntropyestimator. - new_
tsallis_ mi - Macro for creating a new
TsallisMutualInformationestimator. - new_
tsallis_ te - Macro for creating a new
TsallisTransferEntropyestimator.