refactored

This commit is contained in:
2025-04-04 15:34:01 +02:00
parent 57544e5520
commit e6034bd188
-3
View File
@@ -20,16 +20,13 @@ def simple_max(Q, N, t, _tie_break):
am = np.argmax(Q + _tie_break[t])
return am
def ucb(Q, N, t, _tie_break):
c = 2
if N.min() == 0:
# return np.argmax(N + _tie_break[t])
return np.random.choice(np.flatnonzero(N == N.min()))
M = Q + c * np.sqrt(np.divide(np.log(t), N))
return np.argmax(M + _tie_break[t]) # breaking ties randomly
# return np.argmax(M) # breaking ties randomly
class Param:
def __init__(self, epsilon:float=0, rho:float=0, alpha:float =0, q_ic:float=0, argmax_func=simple_max):