pub struct ActiveLearner { /* private fields */ }Expand description
Active learner using Thompson Sampling on clusters
Implementations§
Source§impl ActiveLearner
impl ActiveLearner
Sourcepub fn with_embedder(self, embedder: CodeEmbedder) -> Self
pub fn with_embedder(self, embedder: CodeEmbedder) -> Self
Create with custom embedder
Sourcepub fn with_exploration_rate(self, rate: f64) -> Self
pub fn with_exploration_rate(self, rate: f64) -> Self
Set exploration rate
Sourcepub fn get_cluster(&self, code: &str) -> Option<usize>
pub fn get_cluster(&self, code: &str) -> Option<usize>
Get cluster for a code sample
Sourcepub fn sample_cluster(&self) -> Option<usize>
pub fn sample_cluster(&self) -> Option<usize>
Sample cluster using Thompson Sampling
Returns cluster ID with high expected value (exploration vs exploitation)
§Panics
Panics if Beta distribution creation fails with default parameters (1.0, 1.0), which should never happen for valid alpha/beta values.
Sourcepub fn select_batch(&self, codes: &[&str], batch_size: usize) -> Vec<usize>
pub fn select_batch(&self, codes: &[&str], batch_size: usize) -> Vec<usize>
Select samples for next batch using Thompson Sampling
Returns indices of codes to sample next
Sourcepub fn update_feedback(&mut self, code: &str, revealed_bug: bool)
pub fn update_feedback(&mut self, code: &str, revealed_bug: bool)
Update with oracle feedback
§Arguments
code- The code that was verifiedrevealed_bug- True if verification revealed a bug
Sourcepub fn silhouette_score(&self) -> f32
pub fn silhouette_score(&self) -> f32
Get current silhouette score
Sourcepub fn cluster_stats(&self) -> Vec<ClusterStats>
pub fn cluster_stats(&self) -> Vec<ClusterStats>
Get cluster statistics
Sourcepub fn should_explore(&self) -> bool
pub fn should_explore(&self) -> bool
Check if exploration should be prioritized
Sourcepub fn total_samples(&self) -> usize
pub fn total_samples(&self) -> usize
Get total samples processed
Trait Implementations§
Source§impl Debug for ActiveLearner
impl Debug for ActiveLearner
Auto Trait Implementations§
impl Freeze for ActiveLearner
impl RefUnwindSafe for ActiveLearner
impl Send for ActiveLearner
impl Sync for ActiveLearner
impl Unpin for ActiveLearner
impl UnsafeUnpin for ActiveLearner
impl UnwindSafe for ActiveLearner
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> 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