pub struct MarginRankingLoss {
pub margin: f32,
pub reduction: LossReduction,
}
Expand description
Computes the margin ranking loss.
Fields§
§margin: f32
The margin by which the scores should be separated. Default to
MarginRankingLoss::DEFAULT_MARGIN
reduction: LossReduction
Reduction type. Default to MarginRankingLoss::DEFAULT_REDUCTION
Implementations§
Source§impl MarginRankingLoss
impl MarginRankingLoss
Sourcepub const DEFAULT_MARGIN: f32 = 0f32
pub const DEFAULT_MARGIN: f32 = 0f32
Default value for the margin
parameter.
Sourcepub const DEFAULT_REDUCTION: LossReduction = LossReduction::None
pub const DEFAULT_REDUCTION: LossReduction = LossReduction::None
Default value for the reduction
parameter.
Sourcepub fn apply(
&self,
inputs1: impl AsRef<Array>,
inputs2: impl AsRef<Array>,
targets: impl AsRef<Array>,
) -> Result<Array, Exception>
pub fn apply( &self, inputs1: impl AsRef<Array>, inputs2: impl AsRef<Array>, targets: impl AsRef<Array>, ) -> Result<Array, Exception>
Computes the margin ranking loss.
§Params
inputs1
: Scores for the first input.inputs2
: Scores for the second input.targets
: Labels indicating whether samples ininputs1
should be ranked higher than samples ininputs2
. Values should be 1 or -1.
Trait Implementations§
Source§impl Buildable for MarginRankingLoss
impl Buildable for MarginRankingLoss
Source§type Builder = MarginRankingLossBuilder
type Builder = MarginRankingLossBuilder
The builder type for this buildable type
Source§impl Builder<MarginRankingLoss> for MarginRankingLossBuilder
impl Builder<MarginRankingLoss> for MarginRankingLossBuilder
Source§type Error = Infallible
type Error = Infallible
Error with building
Source§impl Clone for MarginRankingLoss
impl Clone for MarginRankingLoss
Source§fn clone(&self) -> MarginRankingLoss
fn clone(&self) -> MarginRankingLoss
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MarginRankingLoss
impl RefUnwindSafe for MarginRankingLoss
impl Send for MarginRankingLoss
impl Sync for MarginRankingLoss
impl Unpin for MarginRankingLoss
impl UnwindSafe for MarginRankingLoss
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> 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 moreSource§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Convert into an
Option
.