Trait LossFunction

Source
pub trait LossFunction<U>:
    Send
    + Sync
    + 'static
where U: Clone + Copy + UnitValue<U>,
{ // Required methods fn derive(&self, r: U, t: U) -> U; fn apply(&self, r: U, t: U) -> U; fn name(&self) -> &'static str; }
Expand description

Trait that defines the implementation of the loss function used in neural networks during training.

Required Methods§

Source

fn derive(&self, r: U, t: U) -> U

Differentiation of loss functions

§Arguments
  • r - actual value
  • t - expected value
Source

fn apply(&self, r: U, t: U) -> U

Applying the loss function

§Arguments
  • r - actual value
  • t - expected value
Source

fn name(&self) -> &'static str

this loss function name

Implementors§

Source§

impl<U> LossFunction<U> for CrossEntropy<U>
where U: Clone + Copy + UnitValue<U>,

Source§

impl<U> LossFunction<U> for CrossEntropyMulticlass<U>
where U: Clone + Copy + UnitValue<U>,

Source§

impl<U> LossFunction<U> for Mse<U>
where U: Clone + Copy + UnitValue<U>,