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>
impl<const W: usize> DsaWindow<W>
Sourcepub const fn new(ewma_threshold: f32) -> Self
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.
Sourcepub fn push(
&mut self,
sign: &SignTuple,
grammar: GrammarState,
motif_fired: bool,
) -> DsaScore
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.
Sourcepub fn calibrate_ewma_threshold(&mut self, healthy_norms: &[f32])
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> 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