pub struct Bandit<D> { /* private fields */ }
Expand description
A multi-armed bandit
The distribution of each arm has type D
.
Implementations§
Source§impl<D: FromMean<f64>> Bandit<D>
impl<D: FromMean<f64>> Bandit<D>
Sourcepub fn from_means<I: IntoIterator<Item = T>, T: Borrow<f64>>(
means: I,
) -> Result<Self, D::Error>
pub fn from_means<I: IntoIterator<Item = T>, T: Borrow<f64>>( means: I, ) -> Result<Self, D::Error>
Create a new Bandit from a list of means.
Source§impl Bandit<Deterministic<f64>>
impl Bandit<Deterministic<f64>>
Sourcepub fn from_values<I: IntoIterator<Item = T>, T: Borrow<f64>>(values: I) -> Self
pub fn from_values<I: IntoIterator<Item = T>, T: Borrow<f64>>(values: I) -> Self
Create a new DeterministicBandit
from a list of arm rewards
Trait Implementations§
Source§impl<'de, D> Deserialize<'de> for Bandit<D>where
D: Deserialize<'de>,
impl<'de, D> Deserialize<'de> for Bandit<D>where
D: Deserialize<'de>,
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<D: Bounded<f64>> EnvStructure for Bandit<D>
impl<D: Bounded<f64>> EnvStructure for Bandit<D>
type ObservationSpace = SingletonSpace
type ActionSpace = IndexSpace
type FeedbackSpace = IntervalSpace<Reward>
Source§fn observation_space(&self) -> Self::ObservationSpace
fn observation_space(&self) -> Self::ObservationSpace
Space containing all possible observations. Read more
Source§fn action_space(&self) -> Self::ActionSpace
fn action_space(&self) -> Self::ActionSpace
The space of all possible actions. Read more
Source§fn feedback_space(&self) -> Self::FeedbackSpace
fn feedback_space(&self) -> Self::FeedbackSpace
The space of all possible feedback. Read more
Source§fn discount_factor(&self) -> f64
fn discount_factor(&self) -> f64
A discount factor applied to future feedback. Read more
Source§impl<D: Distribution<f64> + Bounded<f64>> Environment for Bandit<D>
impl<D: Distribution<f64> + Bounded<f64>> Environment for Bandit<D>
Source§type Observation = ()
type Observation = ()
Observation of the state provided to the agent.
Source§fn initial_state(&self, _: &mut Prng) -> Self::State
fn initial_state(&self, _: &mut Prng) -> Self::State
Sample a state for the start of a new episode. Read more
Source§fn observe(&self, _: &Self::State, _: &mut Prng) -> Self::State
fn observe(&self, _: &Self::State, _: &mut Prng) -> Self::State
Generate an observation for a given state.
impl<D: Clone> CloneBuild for Bandit<D>
impl<D: Eq> Eq for Bandit<D>
impl<D> StructuralPartialEq for Bandit<D>
Auto Trait Implementations§
impl<D> Freeze for Bandit<D>
impl<D> RefUnwindSafe for Bandit<D>where
D: RefUnwindSafe,
impl<D> Send for Bandit<D>where
D: Send,
impl<D> Sync for Bandit<D>where
D: Sync,
impl<D> Unpin for Bandit<D>where
D: Unpin,
impl<D> UnwindSafe for Bandit<D>where
D: 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
Mutably borrows from an owned value. Read more
Source§impl<T> BuildEnv for T
impl<T> BuildEnv for T
Source§type Observation = <T as Environment>::Observation
type Observation = <T as Environment>::Observation
Environment observation type.
Source§type Action = <T as Environment>::Action
type Action = <T as Environment>::Action
Environment action type.
Source§type Feedback = <T as Environment>::Feedback
type Feedback = <T as Environment>::Feedback
Environment feedback type.
Source§type ObservationSpace = <T as EnvStructure>::ObservationSpace
type ObservationSpace = <T as EnvStructure>::ObservationSpace
Environment observation space type.
Source§type ActionSpace = <T as EnvStructure>::ActionSpace
type ActionSpace = <T as EnvStructure>::ActionSpace
Environment action space type.
Source§type FeedbackSpace = <T as EnvStructure>::FeedbackSpace
type FeedbackSpace = <T as EnvStructure>::FeedbackSpace
Environment feedback space type.
Source§type Environment = T
type Environment = T
Type of environment to build
Source§fn build_env(
&self,
_: &mut ChaCha8Rng,
) -> Result<<T as BuildEnv>::Environment, BuildEnvError>
fn build_env( &self, _: &mut ChaCha8Rng, ) -> Result<<T as BuildEnv>::Environment, BuildEnvError>
Build an environment instance. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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