pub struct PrefetchModel { /* private fields */ }Expand description
Tracks prediction accuracy for model self-evaluation.
Implementations§
Source§impl PrefetchModel
impl PrefetchModel
pub fn new() -> Self
Sourcepub fn predict(
&self,
current_hash: u64,
active_hashes: &[u64],
) -> Vec<(u64, f64)>
pub fn predict( &self, current_hash: u64, active_hashes: &[u64], ) -> Vec<(u64, f64)>
Predict which files will be accessed next, based on current state. Returns (path_hash, confidence) pairs sorted by confidence descending.
Sourcepub fn report_hit(&mut self, predicted_hash: u64, was_accessed: bool)
pub fn report_hit(&mut self, predicted_hash: u64, was_accessed: bool)
Report whether a predicted file was actually accessed (feedback loop).
Sourcepub fn free_energy(&self) -> f64
pub fn free_energy(&self) -> f64
Free Energy = surprise metric. High value means predictions are poor.
Sourcepub fn should_prefetch(&self) -> bool
pub fn should_prefetch(&self) -> bool
Should we actively prefetch? Only when model has learned enough and prediction accuracy is reasonable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrefetchModel
impl RefUnwindSafe for PrefetchModel
impl Send for PrefetchModel
impl Sync for PrefetchModel
impl Unpin for PrefetchModel
impl UnsafeUnpin for PrefetchModel
impl UnwindSafe for PrefetchModel
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
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>
Converts
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>
Converts
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