pub struct FitnessAggregator { /* private fields */ }Expand description
Aggregates partial/incremental feedback into fitness estimates
Implementations§
Source§impl FitnessAggregator
impl FitnessAggregator
Sourcepub fn new(model: AggregationModel) -> Self
pub fn new(model: AggregationModel) -> Self
Create a new aggregator with the given model
Sourcepub fn model(&self) -> &AggregationModel
pub fn model(&self) -> &AggregationModel
Get the aggregation model
Sourcepub fn set_generation(&mut self, generation: usize)
pub fn set_generation(&mut self, generation: usize)
Set the current generation
Sourcepub fn get_stats(&self, id: &CandidateId) -> Option<&CandidateStats>
pub fn get_stats(&self, id: &CandidateId) -> Option<&CandidateStats>
Get stats for a candidate
Sourcepub fn get_fitness(&self, id: &CandidateId) -> Option<f64>
pub fn get_fitness(&self, id: &CandidateId) -> Option<f64>
Get current fitness estimate for a candidate (point estimate only)
For uncertainty information, use get_fitness_estimate() instead.
Sourcepub fn get_fitness_estimate(&self, id: &CandidateId) -> Option<FitnessEstimate>
pub fn get_fitness_estimate(&self, id: &CandidateId) -> Option<FitnessEstimate>
Get fitness estimate with uncertainty quantification
Returns a FitnessEstimate containing the point estimate, variance,
and confidence intervals.
Sourcepub fn comparisons(&self) -> &[ComparisonRecord]
pub fn comparisons(&self) -> &[ComparisonRecord]
Get access to comparison records (for Bradley-Terry MLE)
Sourcepub fn record_rating(&mut self, id: CandidateId, rating: f64)
pub fn record_rating(&mut self, id: CandidateId, rating: f64)
Record a rating for a candidate
Sourcepub fn record_comparison(&mut self, winner: CandidateId, loser: CandidateId)
pub fn record_comparison(&mut self, winner: CandidateId, loser: CandidateId)
Record a pairwise comparison result
Sourcepub fn record_tie(&mut self, id_a: CandidateId, id_b: CandidateId)
pub fn record_tie(&mut self, id_a: CandidateId, id_b: CandidateId)
Record a tie in pairwise comparison
Sourcepub fn record_batch_selection(
&mut self,
selected: &[CandidateId],
not_selected: &[CandidateId],
)
pub fn record_batch_selection( &mut self, selected: &[CandidateId], not_selected: &[CandidateId], )
Record batch selection results
Sourcepub fn recompute_all(&mut self) -> HashMap<CandidateId, f64>
pub fn recompute_all(&mut self) -> HashMap<CandidateId, f64>
Recompute all fitness estimates from comparison history
This is useful for Bradley-Terry model which uses batch MLE, or after loading a session from checkpoint.
Sourcepub fn process_response(
&mut self,
response: &EvaluationResponse,
) -> Vec<(CandidateId, f64)>
pub fn process_response( &mut self, response: &EvaluationResponse, ) -> Vec<(CandidateId, f64)>
Process an evaluation response and return updated fitness values
Sourcepub fn process_pairwise(
&mut self,
id_a: CandidateId,
id_b: CandidateId,
winner: Option<CandidateId>,
) -> Vec<(CandidateId, f64)>
pub fn process_pairwise( &mut self, id_a: CandidateId, id_b: CandidateId, winner: Option<CandidateId>, ) -> Vec<(CandidateId, f64)>
Process a pairwise comparison with both candidate IDs
Sourcepub fn process_batch_selection(
&mut self,
all_candidates: &[CandidateId],
selected: &[CandidateId],
) -> Vec<(CandidateId, f64)>
pub fn process_batch_selection( &mut self, all_candidates: &[CandidateId], selected: &[CandidateId], ) -> Vec<(CandidateId, f64)>
Process batch selection with full context
Sourcepub fn all_candidates(&self) -> Vec<CandidateId>
pub fn all_candidates(&self) -> Vec<CandidateId>
Get all candidate IDs with fitness estimates
Sourcepub fn comparison_count(&self) -> usize
pub fn comparison_count(&self) -> usize
Get the number of comparisons recorded
Trait Implementations§
Source§impl Clone for FitnessAggregator
impl Clone for FitnessAggregator
Source§fn clone(&self) -> FitnessAggregator
fn clone(&self) -> FitnessAggregator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FitnessAggregator
impl Debug for FitnessAggregator
Source§impl<'de> Deserialize<'de> for FitnessAggregator
impl<'de> Deserialize<'de> for FitnessAggregator
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FitnessAggregator
impl RefUnwindSafe for FitnessAggregator
impl Send for FitnessAggregator
impl Sync for FitnessAggregator
impl Unpin for FitnessAggregator
impl UnsafeUnpin for FitnessAggregator
impl UnwindSafe for FitnessAggregator
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> 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>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.