pub struct ThompsonSampling {
pub random_state: Option<u64>,
/* private fields */
}Expand description
Thompson Sampling strategy for multi-armed bandit active learning
This strategy uses Bayesian inference to maintain probability distributions over the reward rates of each arm and samples from these distributions.
Fields§
§random_state: Option<u64>random_state
Implementations§
Source§impl ThompsonSampling
impl ThompsonSampling
pub fn new() -> Self
pub fn random_state(self, random_state: u64) -> Self
pub fn initialize(&mut self, n_arms: usize)
pub fn select_arm(&mut self) -> Result<usize>
pub fn update(&mut self, arm_idx: usize, reward: f64) -> Result<()>
pub fn get_arm_statistics(&self) -> Vec<(f64, f64, f64, f64)>
Trait Implementations§
Source§impl Clone for ThompsonSampling
impl Clone for ThompsonSampling
Source§fn clone(&self) -> ThompsonSampling
fn clone(&self) -> ThompsonSampling
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThompsonSampling
impl Debug for ThompsonSampling
Auto Trait Implementations§
impl Freeze for ThompsonSampling
impl RefUnwindSafe for ThompsonSampling
impl Send for ThompsonSampling
impl Sync for ThompsonSampling
impl Unpin for ThompsonSampling
impl UnwindSafe for ThompsonSampling
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> 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>
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