Module: tf_agents.bandits.policies.linear_bandit_policy

Linear Bandit Policy.

LinUCB and Linear Thompson Sampling policies derive from this class.

This linear policy handles two main forms of feature input.

  1. A single global feature is received per time step. In this case, the policy maintains an independent linear reward model for each arm.
  2. Apart from the global feature as in case 1, an arm-feature vector is received for each arm in every time step. In this case, only one model is maintained by the policy, and the reward estimates are calculated for every arm by using their own per-arm features.

The above two cases can be triggered by setting the boolean parameter accepts_per_arm_features appropriately.

A detailed explanation for the two above cases can be found in the paper "Thompson Sampling for Contextual Bandits with Linear Payoffs", Shipra Agrawal, Navin Goyal, ICML 2013 (, and its supplementary material (


class ExplorationStrategy: Possible exploration strategies.

class LinearBanditPolicy: Linear Bandit Policy to be used by LinUCB, LinTS and possibly others.

absolute_import Instance of __future__._Feature
division Instance of __future__._Feature
print_function Instance of __future__._Feature