Skip to content

thompson

Provides implementations of Thompson sampling strategies.

BetaTSStrategy(general=False)

Bases: Strategy

Thompson sampling strategy with Beta priors.

If general is False, rewards used for updates must be either 0 or 1. Otherwise, rewards must be with support [0, 1].

Parameters:

Name Type Description Default
general bool

Whether to use a generalized version of the strategy.

False
Source code in mabby/strategies/thompson.py
21
22
23
24
25
26
27
28
29
30
def __init__(self, general: bool = False):
    """Initializes a Beta Thompson sampling strategy.

    If ``general`` is ``False``, rewards used for updates must be either 0 or 1.
    Otherwise, rewards must be with support [0, 1].

    Args:
        general: Whether to use a generalized version of the strategy.
    """
    self.general = general