pub struct SupportSetManager<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Support set manager
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static> SupportSetManager<T>
impl<T: Float + Debug + Send + Sync + 'static> SupportSetManager<T>
Sourcepub fn select_support_set(
&self,
candidates: &[Array1<T>],
_labels: &[T],
budget: usize,
) -> Result<Vec<usize>>
pub fn select_support_set( &self, candidates: &[Array1<T>], _labels: &[T], budget: usize, ) -> Result<Vec<usize>>
Select a diverse subset of candidate indices for a support set.
Uses a greedy farthest-point sampling strategy: the first point is selected as the one with the largest norm, then each subsequent point is the one that is most distant from all already-selected points (measured by squared Euclidean distance).
Sourcepub fn augment_support_set(
&self,
support: &[Array1<T>],
noise_scale: T,
) -> Result<Vec<Array1<T>>>
pub fn augment_support_set( &self, support: &[Array1<T>], noise_scale: T, ) -> Result<Vec<Array1<T>>>
Augment a support set by adding Gaussian noise to each example.
For each input vector, produces a copy with noise ~ N(0, noise_scale^2) added to each element (using a simple deterministic hash-based approach for reproducibility without requiring rand).
Sourcepub fn evaluate_quality(&self, support: &[Array1<T>]) -> Result<T>
pub fn evaluate_quality(&self, support: &[Array1<T>]) -> Result<T>
Evaluate the quality/diversity of a support set.
Returns the average pairwise squared Euclidean distance between all support vectors (higher = more diverse = better quality).
Source§impl<T: Float + Debug + Send + Sync + 'static> SupportSetManager<T>
impl<T: Float + Debug + Send + Sync + 'static> SupportSetManager<T>
Sourcepub fn new(config: SupportSetManagerConfig) -> Result<Self>
pub fn new(config: SupportSetManagerConfig) -> Result<Self>
Create a new support set manager
Sourcepub fn from_max_size(max_support_size: usize) -> Result<Self>
pub fn from_max_size(max_support_size: usize) -> Result<Self>
Create from max support size (convenience)
Sourcepub fn max_support_size(&self) -> usize
pub fn max_support_size(&self) -> usize
Get the max support size
Sourcepub fn config(&self) -> &SupportSetManagerConfig
pub fn config(&self) -> &SupportSetManagerConfig
Get the config
Auto Trait Implementations§
impl<T> Freeze for SupportSetManager<T>
impl<T> RefUnwindSafe for SupportSetManager<T>where
T: RefUnwindSafe,
impl<T> Send for SupportSetManager<T>
impl<T> Sync for SupportSetManager<T>
impl<T> Unpin for SupportSetManager<T>where
T: Unpin,
impl<T> UnsafeUnpin for SupportSetManager<T>
impl<T> UnwindSafe for SupportSetManager<T>where
T: UnwindSafe + 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
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>
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>
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.