pub struct CentroidTracker<T: Clone + Eq + Hash> { /* private fields */ }Expand description
Centroid tracker for efficient incremental mode computation
Implementations§
Source§impl<T: Clone + Eq + Hash> CentroidTracker<T>
impl<T: Clone + Eq + Hash> CentroidTracker<T>
Sourcepub fn new(num_features: usize) -> Self
pub fn new(num_features: usize) -> Self
Create a new centroid tracker with the given number of features
Sourcepub fn add_point(&mut self, point_idx: usize, values: &[T]) -> Result<()>
pub fn add_point(&mut self, point_idx: usize, values: &[T]) -> Result<()>
Add a data point to this centroid
Sourcepub fn remove_point(&mut self, point_idx: usize) -> Result<()>
pub fn remove_point(&mut self, point_idx: usize) -> Result<()>
Remove a data point from this centroid
Sourcepub fn get_centroid(&self) -> Result<Vec<T>>
pub fn get_centroid(&self) -> Result<Vec<T>>
Get the current centroid (modes for each feature)
Sourcepub fn init_with_points<I>(
&mut self,
data: ArrayView2<'_, T>,
point_indices: I,
) -> Result<()>where
I: IntoIterator<Item = usize>,
pub fn init_with_points<I>(
&mut self,
data: ArrayView2<'_, T>,
point_indices: I,
) -> Result<()>where
I: IntoIterator<Item = usize>,
Initialize with a set of data points
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CentroidTracker<T>
impl<T> RefUnwindSafe for CentroidTracker<T>where
T: RefUnwindSafe,
impl<T> Send for CentroidTracker<T>where
T: Send,
impl<T> Sync for CentroidTracker<T>where
T: Sync,
impl<T> Unpin for CentroidTracker<T>where
T: Unpin,
impl<T> UnwindSafe for CentroidTracker<T>where
T: UnwindSafe,
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> 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