Policies.Experimentals.UCBcython module

The UCB1 (UCB-alpha) index policy, using a Cython extension.

  • Reference: [Auer et al. 02].

Warning

This extension should be used with the setup.py script, by running:

$ python setup.py build_ext --inplace

You can also use [pyximport](http://docs.cython.org/en/latest/src/tutorial/cython_tutorial.html#pyximport-cython-compilation-for-developers) to import the kullback_cython module transparently:

>>> import pyximport; pyximport.install()  # instantaneous  
(None, <pyximport.pyximport.PyxImporter at 0x...>)
>>> from UCBcython import *     # takes about two seconds
class Policies.Experimentals.UCBcython.UCBcython

Bases: UCB.UCB

The UCB1 (UCB-alpha) index policy, using a Cython extension.

  • Reference: [Auer et al. 02].

__init__
__module__ = 'Policies.Experimentals.UCBcython'
__str__
computeAllIndex

Compute the current indexes for all arms, in a vectorized manner.

computeIndex

Compute the current index, at time t and after \(N_k(t)\) pulls of arm k:

\[I_k(t) = \frac{X_k(t)}{N_k(t)} + \sqrt{\frac{\alpha \log(t)}{2 N_k(t)}}.\]