pub fn hamming_loss<T>(pred: &[T], actual: &[T]) -> Result<f32, LengthError>where
T: Eq,
Expand description
The hamming loss of a dataset
Returns the hamming loss which is the percentage of items which are misclassified [0, 1]
Supports macro and weighted averages
use parsnip::hamming_loss;
let actual = vec![0, 1, 2, 0, 0];
let pred = vec![0, 2, 1, 0, 1];
assert_eq!(hamming_loss(&pred, &actual)?, 0.6);