Skip to main content

Map0132

Enum Map0132 

Source
pub enum Map0132 {
    Identity,
    Linear {
        max: Score32,
    },
    IncSigmoid {
        low: Score32,
        high: Score32,
    },
    DecSigmoid {
        low: Score32,
        high: Score32,
    },
    Cauchy {
        center: Score32,
        scale: Score32,
    },
    Custom(fn(Score32) -> Score32),
}
Expand description

Normalization strategy that maps a raw measure to [0, 1].

All variants except Custom guarantee the output is in [0, 1] by construction. Custom is validated at evaluation time via Value01::witness.

Variants§

§

Identity

Clamp raw to [0, 1].

§

Linear

raw / max, clamped to [0, 1].

Fields

§max: Score32

Upper bound for the raw value.

§

IncSigmoid

Increasing sigmoid: low → 0, high → 1.

Fields

§low: Score32

Lower bound (≈0).

§high: Score32

Upper bound (≈1).

§

DecSigmoid

Decreasing sigmoid: low → 1, high → 0.

Fields

§low: Score32

Lower bound (≈1).

§high: Score32

Upper bound (≈0).

§

Cauchy

Cauchy (Lorentzian) distribution, symmetric about center.

Fields

§center: Score32

Peak center.

§scale: Score32

Scale parameter.

§

Custom(fn(Score32) -> Score32)

User-provided normalization function.

The function receives the raw measure value and must return a value in [0, 1]. The output is validated at evaluation time.

Implementations§

Source§

impl Map0132

Source

pub fn apply( &self, raw: Score32, ) -> Result<Witnessed<Score32, Value01>, &'static str>

Apply the normalization to a raw score.

Returns the normalized value. For Custom, the output is validated; for all other variants correctness is guaranteed by construction.

Trait Implementations§

Source§

impl Clone for Map0132

Source§

fn clone(&self) -> Map0132

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Map0132

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WitnessExt for T

Source§

fn witness(self) -> Witnessing<Self>