Skip to content

Commit

Permalink
rename Bernoulli UCB to Bounded UCB (rlberry-py#345)
Browse files Browse the repository at this point in the history
lgtm
  • Loading branch information
RemyDegenne authored Jul 24, 2023
1 parent 8b6b98f commit ab39abd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/demo_bandits/plot_TS_bandit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
=========================================================================
This script shows how to use Thompson sampling on two examples: Bernoulli and Gaussian bandits.
In the Bernoulli case, we use Thompson sampling with a Beta prior. We compare it to a UCB for
bounded rewards with support in [0,1].
For the Gaussian case, we use a Gaussian prior and compare it to a sub-Gaussian UCB.
"""

import numpy as np
Expand Down Expand Up @@ -36,10 +40,10 @@ def __init__(self, env, **kwargs):
self.env = WriterWrapper(self.env, self.writer, write_scalar="action")


class BernoulliUCBAgent(IndexAgent):
class BoundedUCBAgent(IndexAgent):
"""UCB agent for bounded bandits"""

name = "Bernoulli UCB Agent"
name = "Bounded UCB Agent"

def __init__(self, env, **kwargs):
index, _ = makeBoundedUCBIndex(0, 1)
Expand All @@ -65,7 +69,7 @@ def __init__(self, env, **kwargs):
fit_budget=T,
n_fit=M,
)
for Agent in [BernoulliUCBAgent, BernoulliTSAgent]
for Agent in [BoundedUCBAgent, BernoulliTSAgent]
]

# Agent training
Expand Down

0 comments on commit ab39abd

Please sign in to comment.