(self, arms: List[float], config: TensorQuantizationConfig)
| 23 | quantization scale and offset. |
| 24 | """ |
| 25 | def __init__(self, arms: List[float], config: TensorQuantizationConfig) -> None: |
| 26 | if len(arms) < 2: raise ValueError('Can not initialize bandit with less than 2 arms.') |
| 27 | self.e = 0.1 |
| 28 | self.arms = arms |
| 29 | self.num_of_arms = len(arms) |
| 30 | self.rewards = [EMARecorder() for _ in range(self.num_of_arms)] |
| 31 | self.rewards[0].push(1) |
| 32 | self.last_selected = 0 |
| 33 | self.reference = config.scale.clone() |
| 34 | self.config = config |
| 35 | self.decay = 0.99 |
| 36 | |
| 37 | def roll(self) -> int: |
| 38 | if random.random() > self.e: selected = random.randint(0, len(self.arms) - 1) |
nothing calls this directly
no test coverage detected