From 054c9b849ca30f2a149b5e77ec890c4cb52b4419 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 15 Jun 2024 12:27:10 +0200 Subject: [PATCH] cleaned up --- k-bandits.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/k-bandits.py b/k-bandits.py index cebe66e..e960317 100644 --- a/k-bandits.py +++ b/k-bandits.py @@ -14,10 +14,8 @@ def bandit(bias): if __name__ == '__main__': - kv = 1.0 - epsilon = 0.1 + epsilon = 0.0 # Anti-greediness rho = 0.01 # reduce epsilon with age - alpha = 1.0 qu = np.zeros(K) nu = np.zeros(K) @@ -43,7 +41,7 @@ if __name__ == '__main__': # get reward from bandit r = bandit(ql_star[a]) 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_vec.append(r_sum/N) # Reduce tendency to explore with number of steps (or with age for humans)