pub struct WhrBuilder<P> { /* private fields */ }
Expand description
Builder API for Whr
, with easy ways to add input data and set the number of
iterations for refinement.
Implementations§
Source§impl<P> WhrBuilder<P>
impl<P> WhrBuilder<P>
Sourcepub fn build(self) -> Whr<P>
pub fn build(self) -> Whr<P>
Uses the currently inputted parameters to compute ratings. This does not consume the builder.
Sourcepub fn with_game(
self,
p1: P,
p2: P,
winner: Option<P>,
time: usize,
handicap: Option<EloRating>,
) -> Self
pub fn with_game( self, p1: P, p2: P, winner: Option<P>, time: usize, handicap: Option<EloRating>, ) -> Self
Adds a game record to the builder.
Sourcepub fn with_games(
self,
games: impl Iterator<Item = (P, P, Option<P>, usize, Option<EloRating>)>,
) -> Self
pub fn with_games( self, games: impl Iterator<Item = (P, P, Option<P>, usize, Option<EloRating>)>, ) -> Self
Adds multiple games to the builder at once.
Sourcepub fn with_iterations(self, iterations: u32) -> Self
pub fn with_iterations(self, iterations: u32) -> Self
Sets the number of iterations. By default, the algorithm iterates until a given precision (1e-3 by default) is reached.
Note that passing a value of 0 is the same as indicating that the algorithm should keep the default behavior.
Sourcepub fn with_epsilon(self, epsilon: f64) -> Self
pub fn with_epsilon(self, epsilon: f64) -> Self
Sets the precision at which the algorithm should consider ratings to be stabilized. By default, this value is 1e-3.
Sourcepub fn with_maximum_duration(self, duration: Duration) -> Self
pub fn with_maximum_duration(self, duration: Duration) -> Self
Specifies a maximum duration for the algorithm to run.
Sourcepub fn with_batch_size(self, size: u32) -> Self
pub fn with_batch_size(self, size: u32) -> Self
Specifies how many iterations to perform as a batch before checking for stop conditions such as time or convergence. By default, checks are performed after every batch of 10 iterations.
Note that passing a batch size of 0 will set the batch size to 1.
Sourcepub fn with_w2(self, w2: f64) -> Self
pub fn with_w2(self, w2: f64) -> Self
Sets the w2
parameter, responsible for the variability of ratings over
time.
Sourcepub fn with_virtual_games(self, virtual_games: u32) -> Self
pub fn with_virtual_games(self, virtual_games: u32) -> Self
Sets the number of virtual games to stabilize ratings.
Sourcepub fn compute_normalizing_terms(&mut self, player: usize)
pub fn compute_normalizing_terms(&mut self, player: usize)
Computes the normalizing terms for all sets of games/players.
Trait Implementations§
Source§impl<P: Clone> Clone for WhrBuilder<P>
impl<P: Clone> Clone for WhrBuilder<P>
Source§fn clone(&self) -> WhrBuilder<P>
fn clone(&self) -> WhrBuilder<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<P> Freeze for WhrBuilder<P>
impl<P> RefUnwindSafe for WhrBuilder<P>where
P: RefUnwindSafe,
impl<P> Send for WhrBuilder<P>where
P: Send,
impl<P> Sync for WhrBuilder<P>where
P: Sync,
impl<P> Unpin for WhrBuilder<P>where
P: Unpin,
impl<P> UnwindSafe for WhrBuilder<P>where
P: UnwindSafe,
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