Struct WhrBuilder

Source
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>
where P: Hash + Eq + Clone,

Source

pub fn new() -> Self

Creates a new default builder.

Source

pub fn build(self) -> Whr<P>

Uses the currently inputted parameters to compute ratings. This does not consume the builder.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_maximum_duration(self, duration: Duration) -> Self

Specifies a maximum duration for the algorithm to run.

Source

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.

Source

pub fn with_w2(self, w2: f64) -> Self

Sets the w2 parameter, responsible for the variability of ratings over time.

Source

pub fn with_virtual_games(self, virtual_games: u32) -> Self

Sets the number of virtual games to stabilize ratings.

Source

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>

Source§

fn clone(&self) -> WhrBuilder<P>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P> Default for WhrBuilder<P>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.