Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
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
def _add_common_lin(self, alpha, nchoices, njobs):
if isinstance(alpha, int):
alpha = float(alpha)
assert isinstance(alpha, float)
_BasePolicy._add_choices(self, nchoices)
_check_constructor_input(_ZeroPredictor(), nchoices)
self.njobs = _check_njobs(njobs)
self.alpha = alpha
self.nchoices = nchoices
self._oracles = [_LinUCBnTSSingle(self.alpha, self._ts) for n in range(nchoices)]
if not self._ts:
self.v_sq = self.alpha
del self.alpha
self.is_fitted = False