pub struct WeightLearner {
pub weights: ScoringWeights,
pub learning_rate: f32,
pub n_updates: usize,
}Expand description
Online weight learning from outcome feedback.
Simple gradient update: if the retrieval led to success, decrease the score (make it more likely to be retrieved again). If failure, increase.
Uses a learning rate to control update speed.
Fields§
§weights: ScoringWeightsCurrent weights.
learning_rate: f32Learning rate for gradient updates.
n_updates: usizeNumber of updates applied.
Implementations§
Source§impl WeightLearner
impl WeightLearner
Sourcepub fn new(weights: ScoringWeights, learning_rate: f32) -> Self
pub fn new(weights: ScoringWeights, learning_rate: f32) -> Self
Create a new learner with initial weights.
Sourcepub fn update(&mut self, candidates: &[CandidateFeatures], outcome: f32)
pub fn update(&mut self, candidates: &[CandidateFeatures], outcome: f32)
Update weights based on outcome feedback.
candidates: the features of candidates that were retrieved.
outcome: 1.0 for success, 0.0 for failure.
Adjusts weights to make factors that correlated with success stronger, and factors that correlated with failure weaker.
Auto Trait Implementations§
impl Freeze for WeightLearner
impl RefUnwindSafe for WeightLearner
impl Send for WeightLearner
impl Sync for WeightLearner
impl Unpin for WeightLearner
impl UnwindSafe for WeightLearner
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