Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf_agents.bandits.agents.utils.build_laplacian_over_ordinal_integer_actions

Build the unnormalized Laplacian matrix over ordinal integer actions.

tf_agents.bandits.agents.utils.build_laplacian_over_ordinal_integer_actions(
    *args, **kwargs
)

Assuming integer actions, this functions builds the (unnormalized) Laplacian matrix of the graph implied over the action space. The graph vertices are the integers {0...action_spec.maximum - 1}. Two vertices are adjacent if they correspond to consecutive integer actions. The action_spec must specify a scalar int32 or int64 with minimum zero.

Args:

  • action_spec: a BoundedTensorSpec.

Returns:

The graph Laplacian matrix (float tensor) of size equal to the number of actions. The diagonal elements are equal to 2 and the off-diagonal elements are equal to -1.

Raises:

  • ValueError: if action_spec is not a bounded scalar int32 or int64 spec with minimum 0.