tf_agents.bandits.agents.utils.build_laplacian_over_ordinal_integer_actions

View source on GitHub

Build the unnormalized Laplacian matrix over ordinal integer actions.

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.

action_spec a BoundedTensorSpec.

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.

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