Skip to main content

Map0132

Enum Map0132 

Source
pub enum Map0132 {
    Identity,
    Linear {
        max: f32,
    },
    IncSigmoid {
        low: f32,
        high: f32,
    },
    DecSigmoid {
        low: f32,
        high: f32,
    },
    Cauchy {
        center: f32,
        half_left: f32,
        half_right: f32,
    },
    Custom(fn(f32) -> f32),
}
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: f32

Upper bound for the raw value.

§

IncSigmoid

Increasing sigmoid: low → ≈0, high → ≈1.

Steepness is auto-calibrated: k = 2·ln(1/ε − 1) / (high − low) where ε = 10·f32::EPSILON. At raw = low output ≈ ε, at raw = high ≈ 1−ε.

Fields

§low: f32

Lower bound (≈0).

§high: f32

Upper bound (≈1).

§

DecSigmoid

Decreasing sigmoid: low → ≈1, high → ≈0.

Same auto-calibrated steepness as IncSigmoid, with the sign of k flipped. At raw = low output ≈ 1−ε, at raw = high ≈ ε.

Fields

§low: f32

Lower bound (≈1).

§high: f32

Upper bound (≈0).

§

Cauchy

Asymmetric Cauchy (Lorentzian) with independent left/right half-widths.

Peaks at center with value 1. The half-width at half-maximum is half_left for raw < center and half_right for raw >= center. When half_left == half_right this is the classic symmetric Cauchy.

Fields

§center: f32

Peak center.

§half_left: f32

Half-width at half-maximum for the left side (raw < center).

§half_right: f32

Half-width at half-maximum for the right side (raw >= center).

§

Custom(fn(f32) -> f32)

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: f32) -> Result<Witnessed<f32, 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>