Function parsnip::gini [−][src]
pub fn gini(data: &[u64]) -> f32
Compute the gini impurity of a dataset.
Returns a float, 0 representing a perfectly pure dataset. Normal distribution: ~0.33
By default, any empty dataset will return a gini of 1.0. This may be unexpected behaviour.
use parsnip::gini; assert_eq!(gini(&vec![0, 0, 0, 1]), 0.375);