cleaned up
This commit is contained in:
+2
-4
@@ -14,10 +14,8 @@ def bandit(bias):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
kv = 1.0
|
epsilon = 0.0 # Anti-greediness
|
||||||
epsilon = 0.1
|
|
||||||
rho = 0.01 # reduce epsilon with age
|
rho = 0.01 # reduce epsilon with age
|
||||||
alpha = 1.0
|
|
||||||
|
|
||||||
qu = np.zeros(K)
|
qu = np.zeros(K)
|
||||||
nu = np.zeros(K)
|
nu = np.zeros(K)
|
||||||
@@ -43,7 +41,7 @@ if __name__ == '__main__':
|
|||||||
# get reward from bandit
|
# get reward from bandit
|
||||||
r = bandit(ql_star[a])
|
r = bandit(ql_star[a])
|
||||||
nu[a] = nu[a] + 1
|
nu[a] = nu[a] + 1
|
||||||
qu[a] = qu[a] + alpha*(r - qu[a])/nu[a]
|
qu[a] = qu[a] + (r - qu[a])/nu[a]
|
||||||
r_sum += r
|
r_sum += r
|
||||||
r_vec.append(r_sum/N)
|
r_vec.append(r_sum/N)
|
||||||
# Reduce tendency to explore with number of steps (or with age for humans)
|
# Reduce tendency to explore with number of steps (or with age for humans)
|
||||||
|
|||||||
Reference in New Issue
Block a user