Struct leaf::solver::confusion_matrix::ConfusionMatrix
[−]
[src]
pub struct ConfusionMatrix { // some fields omitted }
Methods
impl ConfusionMatrix
fn new(num_classes: usize) -> ConfusionMatrix
Create a ConfusionMatrix that analyzes the prediction of num_classes
classes.
fn add_sample(&mut self, prediction: usize, target: usize)
Add a sample by providing the expected target
class and the prediction
.
fn add_samples(&mut self, predictions: &[usize], targets: &[usize])
Add a batch of samples.
See add_sample.
fn get_predictions(&self, network_out: &mut SharedTensor<f32>) -> Vec<usize>
Get the predicted classes from the output of a network.
The prediction for each sample of the batch is found by determining which output value had the smallest loss.
fn set_capacity(&mut self, capacity: Option<usize>)
Set the capacity
of the ConfusionMatrix
fn samples(&self) -> &VecDeque<Sample>
Return all collected samples.
fn accuracy(&self) -> Accuracy
Return the accuracy of the collected predictions.