lawsynth/crates/lawsynth-stats/examples/information_basic.rs
2026-08-16 21:04:23 +03:00

11 lines
297 B
Rust

use lawsynth_stats::{HistogramConfig, histogram_mutual_information};
fn main() {
let x = [0.0, 1.0, 2.0, 3.0, 4.0];
let y = [0.0, 1.0, 2.0, 3.0, 4.0];
println!(
"I(x;y) = {:.4} nats",
histogram_mutual_information(&x, &y, HistogramConfig { bins: 3 }).unwrap()
);
}