refactored
This commit is contained in:
@@ -20,16 +20,13 @@ def simple_max(Q, N, t, _tie_break):
|
|||||||
am = np.argmax(Q + _tie_break[t])
|
am = np.argmax(Q + _tie_break[t])
|
||||||
return am
|
return am
|
||||||
|
|
||||||
|
|
||||||
def ucb(Q, N, t, _tie_break):
|
def ucb(Q, N, t, _tie_break):
|
||||||
c = 2
|
c = 2
|
||||||
if N.min() == 0:
|
if N.min() == 0:
|
||||||
# return np.argmax(N + _tie_break[t])
|
|
||||||
return np.random.choice(np.flatnonzero(N == N.min()))
|
return np.random.choice(np.flatnonzero(N == N.min()))
|
||||||
|
|
||||||
M = Q + c * np.sqrt(np.divide(np.log(t), N))
|
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 + _tie_break[t]) # breaking ties randomly
|
||||||
# return np.argmax(M) # breaking ties randomly
|
|
||||||
|
|
||||||
class Param:
|
class Param:
|
||||||
def __init__(self, epsilon:float=0, rho:float=0, alpha:float =0, q_ic:float=0, argmax_func=simple_max):
|
def __init__(self, epsilon:float=0, rho:float=0, alpha:float =0, q_ic:float=0, argmax_func=simple_max):
|
||||||
|
|||||||
Reference in New Issue
Block a user