Skip to main content

MMLPathValidator

Struct MMLPathValidator 

Source
pub struct MMLPathValidator {
    pub compression_level: u32,
}
Expand description

Validates a tensor transformation using Minimum Message Length (Kolmogorov) principles.

The MML score measures how well the output compresses relative to the input. A lower score means the transformation found a more optimal encoding path. The proof is valid only if mml_score <= mml_threshold.

Fields§

§compression_level: u32

Implementations§

Source§

impl MMLPathValidator

Source

pub fn compute_mml_score( &self, input: &Tensor, output: &Tensor, ) -> TribeResult<f64>

Compute the MML score: ratio of compressed output length to compressed input length. Score < 1.0 means the transformation produced a more compressible result.

Source

pub fn compute_entropy_mml_score(&self, input: &Tensor, output: &Tensor) -> f64

Compute an MML-like score using the same byte-level entropy approximation implemented on ESP firmware. This does NOT use DEFLATE and is intended for calibration and comparison only.

Score is defined as: output_entropy / input_entropy, where entropy is Shannon entropy over the raw little-endian bytes of the tensor data.

Source

pub fn validate(&self, mml_score: f64, mml_threshold: f64) -> bool

Check whether an MML score passes the threshold for a given difficulty.

Source

pub fn threshold_for_difficulty(base_threshold: f64, difficulty: u64) -> f64

Compute the MML threshold for a given difficulty level. Tighter (lower) thresholds at higher difficulties.

Trait Implementations§

Source§

impl Default for MMLPathValidator

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.