pub struct TickIntervalModel { /* private fields */ }Expand description
Learned tick-interval recommender replacing the four-tier
step-function in crate::weaver::WeaverEngine::recommend_tick_interval.
Inputs (3): cpm (changes per minute), idle_ticks,
variance (a free-form change-rate variance signal in [0, 1]).
Output (1): recommended tick interval in milliseconds.
Fallback: returns 1000 ms (the steady-state default the old
step-function returned for moderate change rates). When the model
is not yet trained, callers must keep the original step-function
reachable so the historical thresholds (200 / 1000 / 3000 / 5000)
continue to apply — see Self::recommend_or for the helper that
implements that policy.
NOTE(eml-swap): wired — Finding #7 (TickIntervalModel).
Implementations§
Source§impl TickIntervalModel
impl TickIntervalModel
Sourcepub fn drain_events(&mut self) -> Vec<EmlEvent>
pub fn drain_events(&mut self) -> Vec<EmlEvent>
Drain accumulated EML lifecycle events for ExoChain forwarding.
Sourcepub fn is_trained(&self) -> bool
pub fn is_trained(&self) -> bool
Whether the model has been trained.
Sourcepub fn training_sample_count(&self) -> usize
pub fn training_sample_count(&self) -> usize
Number of training samples collected.
Sourcepub fn predict(&self, cpm: f64, idle_ticks: u64, variance: f64) -> u32
pub fn predict(&self, cpm: f64, idle_ticks: u64, variance: f64) -> u32
Predict the recommended tick interval in milliseconds.
Result is clamped to [100, 60_000] ms. When untrained,
returns 1000 ms (the central tier of the legacy step-function).
Sourcepub fn recommend_or(
&self,
cpm: f64,
idle_ticks: u64,
variance: f64,
fallback: u32,
) -> u32
pub fn recommend_or( &self, cpm: f64, idle_ticks: u64, variance: f64, fallback: u32, ) -> u32
Recommend a tick interval: when trained returns
Self::predict; otherwise returns the caller-provided
fallback (typically the existing step-function’s choice).
Trait Implementations§
Source§impl Clone for TickIntervalModel
impl Clone for TickIntervalModel
Source§impl Debug for TickIntervalModel
impl Debug for TickIntervalModel
Source§impl Default for TickIntervalModel
impl Default for TickIntervalModel
Source§impl<'de> Deserialize<'de> for TickIntervalModel
impl<'de> Deserialize<'de> for TickIntervalModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TickIntervalModel
impl RefUnwindSafe for TickIntervalModel
impl Send for TickIntervalModel
impl Sync for TickIntervalModel
impl Unpin for TickIntervalModel
impl UnsafeUnpin for TickIntervalModel
impl UnwindSafe for TickIntervalModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more