banditpylib.arms

Classes

class banditpylib.arms.Arm(name: Optional[str])[source]
Parameters

name (Optional[str]) – alias name

Inheritance

Inheritance diagram of Arm
property name: str

Arm name

class banditpylib.arms.PseudoArm(name: Optional[str] = None)[source]

Pseudo arm

This class is used to store empirical information of an arm.

Parameters

name (Optional[str]) – alias name

Inheritance

Inheritance diagram of PseudoArm
property em_mean: float

Empirical mean of rewards

property em_std: float

Empirical standard variance of rewards

property em_var: float

Empirical variance of rewards

reset()[source]

Clear information

property total_pulls: int

Total number of pulls

property total_rewards: float

Total rewards obtained so far

update(rewards: numpy.ndarray)[source]

Update information

Parameters

rewards – empirical rewards

class banditpylib.arms.StochasticArm(name: Optional[str])[source]

Stochastic arm

Parameters

name (Optional[str]) – alias name

Inheritance

Inheritance diagram of StochasticArm
abstract property mean: float

Mean of rewards

abstract pull(pulls: Optional[int] = None)Union[float, numpy.ndarray][source]

Pull the arm

When pulls is None, a float number will be returned. Otherwise, a numpy array will be returned.

Parameters

pulls – number of times to pull

Returns

stochastic rewards

class banditpylib.arms.BernoulliArm(mu: float, name: Optional[str] = None)[source]

Bernoulli arm

Arm with rewards generated from a Bernoulli distribution.

Parameters
  • mu (float) – mean of rewards

  • name (Optional[str]) – alias name

Inheritance

Inheritance diagram of BernoulliArm
property mean: float

Mean of rewards

pull(pulls: Optional[int] = None)Union[float, numpy.ndarray][source]

Pull the arm

When pulls is None, a float number will be returned. Otherwise, a numpy array will be returned.

Parameters

pulls – number of times to pull

Returns

stochastic rewards

class banditpylib.arms.GaussianArm(mu: float, std: float, name: Optional[str] = None)[source]

Gaussian arm

Arm with rewards generated from a Gaussian distribution.

Parameters
  • mu (float) – mean of rewards

  • std (float) – standard deviation of rewards

  • name (Optional[str]) – alias name

Inheritance

Inheritance diagram of GaussianArm
property mean: float

Mean of rewards

pull(pulls: Optional[int] = None)Union[float, numpy.ndarray][source]

Pull the arm

When pulls is None, a float number will be returned. Otherwise, a numpy array will be returned.

Parameters

pulls – number of times to pull

Returns

stochastic rewards

property std: float

Standard deviation of rewards