Skip to content

GaussianBandit-misc

GaussianBandit

Bases: Environment[EnvState, EnvParams]

Decide whether a stochastic Gaussian arm beats a fixed zero-reward arm.

Two-armed Gaussian bandit for meta-learning as in Lange & Sprekeler (2022). The first arm always pays a reward of 0. The mean mu of the second arm is sampled at every reset from a Gaussian with mean params.mean_mu and standard deviation params.sigma_p and stays fixed for the whole episode.

  • Observation: Box of shape (4,) with the last reward, the one-hot encoded last action and the time step (normalized if params.normalize_time).
  • Actions: Discrete(2). 0 pulls the fixed arm, 1 the stochastic arm.
  • Reward: 0 for the first arm. For the second arm a sample from a Gaussian with mean mu and standard deviation params.sigma_l.
  • Termination: never.
  • Truncation: after params.max_steps_in_episode steps (100 by default).
References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the GaussianBandit environment.

Attributes:

  • mean_mu (float) –

    Mean of the Gaussian from which the second arm's mean reward mu is sampled at every reset.

  • sigma_p (float) –

    Standard deviation of mu across episodes.

  • sigma_l (float) –

    Standard deviation of the second arm's reward across pulls.

  • normalize_time (bool) –

    Whether the time step in the observation is rescaled so that steps 0 and 100 map to -1 and 1, instead of given as a raw step count.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the GaussianBandit environment.

Attributes:

  • last_action (int) –

    Arm pulled in the previous step (0 after a reset).

  • last_reward (Array) –

    Reward received in the previous step (0 after a reset).

  • mu (Array) –

    Mean reward of the second arm in the current episode.

  • time (float) –

    Number of steps taken in the current episode.