class_docstr: Contextual bandit policy base class.
  
  Parameters
  ----------
  reward_obj
      The reward object used to measure the performance of each arm. This can be a metric, a
      statistic, or a distribution.
  reward_scaler
      A reward scaler used to scale the rewards before they are fed to the reward object. This
      can be useful to scale the rewards to a (0, 1) range for instance.
  burn_in
      The number of steps to use for the burn-in phase. Each arm is given the chance to be pulled
      during the burn-in phase. This is useful to mitigate selection bias.
class_docstr_tok: ["Contextual","bandit","policy","base","class",".","Parameters","--","--","--","--","--","reward_obj","The","reward","object","used","to","measure","the","performance","of","each","arm",".","This","can","be","a","metric",",","a","statistic",",","or","a","distribution",".","reward_scaler","A","reward","scaler","used","to","scale","the","rewards","before","they","are","fed","to","the","reward","object",".","This","can","be","useful","to","scale","the","rewards","to","a","(","0",",","1",")","range","for","instance",".","burn_in","The","number","of","steps","to","use","for","the","burn-in","phase",".","Each","arm","is","given","the","chance","to","be","pulled","during","the","burn-in","phase",".","This","is","useful","to","mitigate","selection","bias","."]
docstr: Update an arm's state.
  
  Parameters
  ----------
  arm_id
      The arm to update.
  context
      The context associated with the arm. Doesn't have to be provided if the policy is not
      contextual.
  reward_kwargs
      Keyword arguments to pass to the reward object.
docstr_tok: ["Update","an","arm","'s","state",".","Parameters","--","--","--","--","--","arm_id","The","arm","to","update",".","context","The","context","associated","with","the","arm",".","Does","n't","have","to","be","provided","if","the","policy","is","not","contextual",".","reward_kwargs","Keyword","arguments","to","pass","to","the","reward","object","."]
code: def update(self, arm_id, context, *reward_args, **reward_kwargs):
      """Update an arm's state.
  
      Parameters
      ----------
      arm_id
          The arm to update.
      context
          The context associated with the arm. Doesn't have to be provided if the policy is not
          contextual.
      reward_kwargs
          Keyword arguments to pass to the reward object.
  
      """
  
      if self.reward_scaler:
          reward = reward_args[0]
          self.reward_scaler._update(y=reward)
          reward = self.reward_scaler.func(reward)
          reward_args = (reward,)
  
      self._rewards[arm_id].update(*reward_args, **reward_kwargs)
      self._counts[arm_id] += 1
      self._n += 1
  
imports: from __future__ import annotations
  import abc
  import collections
  import typing
  from collections import Counter
  from river import base, compose, metrics, proba, stats, utils
label_desc: Use image node_id 3 for calling the ContextualPolicy obj's underlying member method code with example usage: obj.update(arm_id, context) without return types