pub struct WindowCoherence {
pub score: f32,
pub metric_scores: Vec<f32>,
pub metrics: Vec<CoherenceMetric>,
pub window_size: usize,
pub is_stale: bool,
pub tokens_since_update: usize,
}Expand description
Per-window coherence scores
Fields§
§score: f32Overall coherence score (0 = fragmented, 1 = coherent)
metric_scores: Vec<f32>Individual metric scores
metrics: Vec<CoherenceMetric>Which metrics were used
window_size: usizeNumber of keys in window
is_stale: boolWhether this coherence is stale (needs update)
tokens_since_update: usizeToken count since last update
Implementations§
Source§impl WindowCoherence
impl WindowCoherence
Sourcepub fn compute(
keys: &[&[f32]],
k_neighbors: usize,
metrics: &[CoherenceMetric],
) -> Self
pub fn compute( keys: &[&[f32]], k_neighbors: usize, metrics: &[CoherenceMetric], ) -> Self
Compute coherence from keys
Sourcepub fn mark_stale(&mut self)
pub fn mark_stale(&mut self)
Mark as stale (needs recomputation)
Sourcepub fn needs_update(&self, update_period: usize) -> bool
pub fn needs_update(&self, update_period: usize) -> bool
Check if update is needed based on period
Trait Implementations§
Source§impl Clone for WindowCoherence
impl Clone for WindowCoherence
Source§fn clone(&self) -> WindowCoherence
fn clone(&self) -> WindowCoherence
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WindowCoherence
impl RefUnwindSafe for WindowCoherence
impl Send for WindowCoherence
impl Sync for WindowCoherence
impl Unpin for WindowCoherence
impl UnwindSafe for WindowCoherence
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