ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf_agents.bandits.environments.non_stationary_stochastic_environment.EnvironmentDynamics

Abstract class to represent a non-stationary environment dynamics.

This class is used with the NonStationaryStochasticEnvironment class below to obtain a non-stationary environment. To define a dynamics, derive from this class and define the abstract methods and properties below. To work correctly with graph and eager mode, Tensorflow variables must be defined in the constructor of this class. When used within a BanditTFEnvironment autodeps in reset and step functions will handle automatically the operation order.

action_spec Specification of the actions.
batch_size Returns the batch size used for observations and rewards.
observation_spec Specification of the observations.

Methods

observation

View source

Returns an observation batch for the given time.

Args
env_time The scalar int64 tensor of the environment time step. This is incremented by the environment after the reward is computed.

Returns
The observation batch with spec according to observation_spec.

reward

View source

Reward for the given observation and time step.

Args
observation A batch of observations with spec according to observation_spec.
env_time The scalar int64 tensor of the environment time step. This is incremented by the environment after the reward is computed.

Returns
A batch of rewards with spec shape [batch_size, num_actions] containing rewards for all arms.