Function rusty_machine::analysis::score::accuracy
[−]
[src]
pub fn accuracy<I>(outputs: I, targets: I) -> f64 where I: ExactSizeIterator, I::Item: PartialEq
Returns the fraction of outputs which match their target.
Arguments
outputs
- Iterator of output (predicted) labels.targets
- Iterator of expected (actual) labels.
Examples
use rusty_machine::analysis::score::accuracy; let outputs = [1, 1, 1, 0, 0, 0]; let targets = [1, 1, 0, 0, 1, 1]; assert_eq!(accuracy(outputs.iter(), targets.iter()), 0.5);
Panics
- outputs and targets have different length