Skip to main content

cross_entropy

Function cross_entropy 

Source
pub fn cross_entropy(p: &[f64], q: &[f64]) -> f64
Expand description

The cross entropy -Σ p log2 q in bits. Infinite if q is zero where p is positive. Returns NaN if the slices differ in length or contain negative values.