How to use the contextualbandits.online._BasePolicy._check_new_arm_name function in contextualbandits

To help you get started, we’ve selected a few contextualbandits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github david-cortes / contextualbandits / contextualbandits / online.py View on Github external
def add_arm(self, arm_name = None):
        """
        Adds a new arm to the pool of choices

        Parameters
        ----------
        arm_name : object
            Name for this arm. Only applicable when using named arms. If None, will use the name of the last
            arm plus 1 (will only work when the names are integers).

        Returns
        -------
        self : object
            This object
        """
        arm_name = _BasePolicy._check_new_arm_name(self, arm_name)
        self._oracles.append(_LinUCBnTSSingle(self.alpha, self._ts))
        _BasePolicy._append_arm(self, arm_name)
        return self