Skip to content

sample_observations ​

python
sample_observations(env: OakEmuMultiEnv, policy: Policy, *, episodes: int, max_actions: int, max_observations: int, environment_id: int = 0) -> ObservationSample

Play episodes from the start with a policy and keep every observation it acted on.

The point is to measure a network on the states it really sees, so the policy should be the one being measured and sampling should be stochastic, like the actor's. The terminal observation of an episode is not kept, since the policy never acts on it.

Parameters:

  • env (OakEmuMultiEnv) – A started multi-environment. Only environment_id is used.
  • policy (Policy) – Chooses the action for an observation.
  • episodes (int) – Episodes to play.
  • max_actions (int) – Actions after which an episode is abandoned, guarding against states a game cannot finish from.
  • max_observations (int) – Stop, mid-episode if need be, once this many observations are held.
  • environment_id (int) – The environment within env to play in.

Returns:

  • ObservationSample – The sample.

Source