pub struct PatternAffinityClassifier { /* private fields */ }Expand description
Pattern Affinity Classifier for routing-drift protection.
Central component that computes affinity scores and provides gating decisions for pattern extraction pipeline.
Implementations§
Source§impl PatternAffinityClassifier
impl PatternAffinityClassifier
Sourcepub fn with_config(affinity_threshold: f32, min_success_rate: f32) -> Self
pub fn with_config(affinity_threshold: f32, min_success_rate: f32) -> Self
Create classifier with custom thresholds.
Sourcepub fn compute_affinity(
&self,
episode: &Episode,
old_patterns: &[Pattern],
new_patterns: &[Pattern],
episode_embedding: Option<&[f32]>,
) -> RelativeAffinity
pub fn compute_affinity( &self, episode: &Episode, old_patterns: &[Pattern], new_patterns: &[Pattern], episode_embedding: Option<&[f32]>, ) -> RelativeAffinity
Compute relative affinity for an episode against pattern clusters.
This is the core Drel computation from DyMoE:
- Compares episode embedding to centroids of old and new patterns
- Returns relative difference to detect ambiguous episodes
Sourcepub fn create_guard(
&self,
episode: &Episode,
old_patterns: &[Pattern],
new_patterns: &[Pattern],
episode_embedding: Option<&[f32]>,
) -> EpisodeAssignmentGuard
pub fn create_guard( &self, episode: &Episode, old_patterns: &[Pattern], new_patterns: &[Pattern], episode_embedding: Option<&[f32]>, ) -> EpisodeAssignmentGuard
Create assignment guard for an episode.
Combines episode’s success rate with computed affinity clarity.
Sourcepub fn should_gate_episode(
&self,
episode: &Episode,
old_patterns: &[Pattern],
new_patterns: &[Pattern],
episode_embedding: Option<&[f32]>,
) -> bool
pub fn should_gate_episode( &self, episode: &Episode, old_patterns: &[Pattern], new_patterns: &[Pattern], episode_embedding: Option<&[f32]>, ) -> bool
Check if episode should be gated from pattern mutation.
Returns true if the episode is ambiguous and should NOT mutate existing high-performing patterns.
Sourcepub fn affinity_threshold(&self) -> f32
pub fn affinity_threshold(&self) -> f32
Get the configured affinity threshold.
Sourcepub fn min_success_rate(&self) -> f32
pub fn min_success_rate(&self) -> f32
Get the configured minimum success rate.
Trait Implementations§
Source§impl Clone for PatternAffinityClassifier
impl Clone for PatternAffinityClassifier
Source§fn clone(&self) -> PatternAffinityClassifier
fn clone(&self) -> PatternAffinityClassifier
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 moreSource§impl Debug for PatternAffinityClassifier
impl Debug for PatternAffinityClassifier
Auto Trait Implementations§
impl Freeze for PatternAffinityClassifier
impl RefUnwindSafe for PatternAffinityClassifier
impl Send for PatternAffinityClassifier
impl Sync for PatternAffinityClassifier
impl Unpin for PatternAffinityClassifier
impl UnsafeUnpin for PatternAffinityClassifier
impl UnwindSafe for PatternAffinityClassifier
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.