pub struct TaskDetector<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Task detector for continual learning
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static> TaskDetector<T>
impl<T: Float + Debug + Send + Sync + 'static> TaskDetector<T>
Sourcepub fn buffered_rounds(&self) -> usize
pub fn buffered_rounds(&self) -> usize
Number of rounds currently buffered.
Sourcepub fn detect_task_change(
&mut self,
updates: &[Array1<T>],
round: usize,
) -> Result<bool>
pub fn detect_task_change( &mut self, updates: &[Array1<T>], round: usize, ) -> Result<bool>
Detect whether this round’s updates come from a different task.
Returns false (and buffers the round) until there is history to compare
against. The comparison is the larger of
- the relative L2 shift
||mean_now - mean_history|| / max(||mean_history||, eps), and - the cosine dissimilarity
(1 - cos(mean_now, mean_history)) / 2,
so both a magnitude jump and a direction reversal are detected.
Source§impl<T: Float + Debug + Send + Sync + 'static> TaskDetector<T>
impl<T: Float + Debug + Send + Sync + 'static> TaskDetector<T>
Sourcepub fn detection_threshold(&self) -> f64
pub fn detection_threshold(&self) -> f64
Detection threshold on the normalised gradient shift.
Sourcepub fn set_detection_threshold(&mut self, threshold: f64) -> Result<()>
pub fn set_detection_threshold(&mut self, threshold: f64) -> Result<()>
Replace the detection threshold.
Sourcepub fn detection_method(&self) -> TaskDetectionMethod
pub fn detection_method(&self) -> TaskDetectionMethod
The configured detection method.
Sourcepub fn change_points(&self) -> &[ChangePoint]
pub fn change_points(&self) -> &[ChangePoint]
Change points detected so far.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TaskDetector<T>
impl<T> RefUnwindSafe for TaskDetector<T>where
T: RefUnwindSafe,
impl<T> Send for TaskDetector<T>
impl<T> Sync for TaskDetector<T>
impl<T> Unpin for TaskDetector<T>
impl<T> UnsafeUnpin for TaskDetector<T>
impl<T> UnwindSafe for TaskDetector<T>where
T: RefUnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.