pub struct MetricSet { /* private fields */ }Expand description
Combined metric tracker that holds both regression and classification metrics.
Useful when evaluating a model that may be used for either task, or when tracking both types of metrics simultaneously during experimentation.
§Example
use irithyll::metrics::MetricSet;
let mut ms = MetricSet::new();
ms.update_regression(3.0, 2.8);
ms.update_classification(1, 1, 0.9);
assert!(ms.regression().mae() > 0.0);
assert!(ms.classification().accuracy() > 0.0);Implementations§
Source§impl MetricSet
impl MetricSet
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new metric set with empty regression and classification trackers.
Sourcepub fn update_regression(&mut self, target: f64, prediction: f64)
pub fn update_regression(&mut self, target: f64, prediction: f64)
Update regression metrics with a (target, prediction) pair.
Sourcepub fn update_classification(
&mut self,
target: usize,
predicted: usize,
predicted_proba: f64,
)
pub fn update_classification( &mut self, target: usize, predicted: usize, predicted_proba: f64, )
Update classification metrics with a single observation.
target: true class label.predicted: predicted class label.predicted_proba: model’s predicted probability for the positive class.
Sourcepub fn regression(&self) -> &RegressionMetrics
pub fn regression(&self) -> &RegressionMetrics
Reference to the regression metrics tracker.
Sourcepub fn classification(&self) -> &ClassificationMetrics
pub fn classification(&self) -> &ClassificationMetrics
Reference to the classification metrics tracker.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetricSet
impl RefUnwindSafe for MetricSet
impl Send for MetricSet
impl Sync for MetricSet
impl Unpin for MetricSet
impl UnsafeUnpin for MetricSet
impl UnwindSafe for MetricSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more