Skip to main content

ClassifierScore

Trait ClassifierScore 

Source
pub trait ClassifierScore<F: Float> {
    // Required method
    fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>;
}
Expand description

Mean-accuracy score(x, y) exposed on every fitted classifier in this crate via a blanket impl over Predict<Array2<F>, Output=Array1<usize>>.

Users just use ferrolearn_linear::ClassifierScore; to call fitted.score(&x, &y) and get the same result as sklearn’s ClassifierMixin.score.

Required Methods§

Source

fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>

Mean accuracy on the given test data and labels.

§Errors

Returns FerroError::ShapeMismatch if x.nrows() != y.len(), or any error forwarded from the inner predict.

Implementors§

Source§

impl<T, F> ClassifierScore<F> for T
where T: Predict<Array2<F>, Output = Array1<usize>, Error = FerroError>, F: Float,