Skip to main content

DsaWindow

Struct DsaWindow 

Source
pub struct DsaWindow<const W: usize> { /* private fields */ }
Expand description

Fixed-capacity DSA window.

W_DSA = window width for accumulation (default 10, paper Stage III). K = persistence threshold (default 4).

Implementations§

Source§

impl<const W: usize> DsaWindow<W>

Source

pub const fn new(ewma_threshold: f32) -> Self

Create a new DSA window with paper Stage III defaults.

λ = 0.20, unit weights, δ_s = 0.05. ewma_threshold should be set from healthy-window calibration.

Source

pub fn push( &mut self, sign: &SignTuple, grammar: GrammarState, motif_fired: bool, ) -> DsaScore

Push one observation and compute the DSA score.

motif_fired: true if a named (non-Unknown) motif was identified.

Source

pub fn reset(&mut self)

Reset the DSA window (e.g., after post-transition guard expires).

Source

pub fn calibrate_ewma_threshold(&mut self, healthy_norms: &[f32])

Calibrate the EWMA threshold from healthy-window observations.

Sets ewma_threshold = mean_ewma_norm + 3 * std_ewma_norm over healthy window.

Auto Trait Implementations§

§

impl<const W: usize> Freeze for DsaWindow<W>

§

impl<const W: usize> RefUnwindSafe for DsaWindow<W>

§

impl<const W: usize> Send for DsaWindow<W>

§

impl<const W: usize> Sync for DsaWindow<W>

§

impl<const W: usize> Unpin for DsaWindow<W>

§

impl<const W: usize> UnsafeUnpin for DsaWindow<W>

§

impl<const W: usize> UnwindSafe for DsaWindow<W>

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, 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.