pub struct UncertaintySampling { /* private fields */ }Expand description
Uncertainty Sampling for Active Learning
Uncertainty sampling selects samples for labeling based on the model’s uncertainty about their predictions. It supports multiple uncertainty measures including entropy, margin, and least confident sampling.
§Parameters
strategy- Uncertainty sampling strategy (“entropy”, “margin”, “least_confident”)n_samples- Number of samples to select for labelingtemperature- Temperature scaling for probability calibrationdiversity_weight- Weight for diversity-based selectionbatch_size- Size of batches for efficient computation
§Examples
ⓘ
use sklears_semi_supervised::UncertaintySampling;
let probas = array![
[0.9, 0.1],
[0.6, 0.4],
[0.5, 0.5],
[0.8, 0.2]
];
let us = UncertaintySampling::new()
.strategy("entropy".to_string())
.n_samples(2);
let selected_indices = us.select_samples(&probas.view()).unwrap();Implementations§
Source§impl UncertaintySampling
impl UncertaintySampling
Sourcepub fn temperature(self, temperature: f64) -> Self
pub fn temperature(self, temperature: f64) -> Self
Set the temperature for probability calibration
Sourcepub fn diversity_weight(self, weight: f64) -> Self
pub fn diversity_weight(self, weight: f64) -> Self
Set the diversity weight
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Set the batch size for computation
Sourcepub fn random_tie_breaking(self, random: bool) -> Self
pub fn random_tie_breaking(self, random: bool) -> Self
Enable/disable random tie breaking
Sourcepub fn select_samples(
&self,
probas: &ArrayView2<'_, f64>,
) -> SklResult<Vec<usize>>
pub fn select_samples( &self, probas: &ArrayView2<'_, f64>, ) -> SklResult<Vec<usize>>
Select samples based on uncertainty
Trait Implementations§
Source§impl Clone for UncertaintySampling
impl Clone for UncertaintySampling
Source§fn clone(&self) -> UncertaintySampling
fn clone(&self) -> UncertaintySampling
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 UncertaintySampling
impl Debug for UncertaintySampling
Auto Trait Implementations§
impl Freeze for UncertaintySampling
impl RefUnwindSafe for UncertaintySampling
impl Send for UncertaintySampling
impl Sync for UncertaintySampling
impl Unpin for UncertaintySampling
impl UnwindSafe for UncertaintySampling
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