Skip to content

ucb

Provides implementations of upper confidence bound (UCB) strategies.

UCB1Strategy(alpha)

Bases: Strategy

Strategy using the UCB1 bandit algorithm.

Parameters:

Name Type Description Default
alpha float

The exploration parameter.

required
Source code in mabby/strategies/ucb.py
21
22
23
24
25
26
27
28
29
def __init__(self, alpha: float) -> None:
    """Initializes a UCB1 strategy.

    Args:
        alpha: The exploration parameter.
    """
    if alpha < 0:
        raise ValueError("alpha must be greater than 0")
    self.alpha = alpha