normalized_entropy

Function normalized_entropy 

Source
pub fn normalized_entropy<T>(data: &[T], n_bins: u8) -> Option<f64>
where T: Num + NumCast + Copy + PartialOrd,
Expand description

Computes the normalized Shannon entropy of a numeric data series.

This estimates the entropy of a continuous data series which tells you the the upper limit on the information content of the data.

  • 0.0 indicates no uncertainty (all data in one bin),
  • 1.0 indicates maximal uncertainty (uniform distribution).

The higher the entropy the more information it may carry, and the lower the entropy the less information it may carry.

ยงExamples

use quant_mathema::stats::normalized_entropy;

let data = [1.0, 2.0, 2.0, 3.0, 4.0, 5.0, 1.0, 4.0, 3.0, 2.0];
let entropy = normalized_entropy(&data, 5);
assert!(entropy.unwrap() > 0.5 && entropy.unwrap() < 1.0);