From 35bc541b5ba94d363e2a3b6c3423dcde98cda1bf Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 2 Apr 2025 11:44:29 +0200 Subject: [PATCH] - improved scalability - Plot: added proper Achsenbeschriftung and Title --- k-bandits.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/k-bandits.py b/k-bandits.py index 84c6bb5..dfed985 100644 --- a/k-bandits.py +++ b/k-bandits.py @@ -50,7 +50,7 @@ if __name__ == '__main__': # init bandits with different biases for shifting reward probability # -> expected reward q*(a) - ql_star = np.array([-0.4, -0.3, -0.2, -0.1, 0.0, +0.1, +0.2, +0.3, +0.4, +0.5]) + ql_star = np.array(np.linspace(-0.5, +0.5, K)) num_realisations = 10 episode_len = 10000 @@ -68,6 +68,9 @@ if __name__ == '__main__': pl.plot(r_mean/num_realisations) pl.grid() + pl.title(f"Norm. E(R), num. realizations: Z={num_realisations}, num. bandits: K={K}") + pl.xlabel("Episode") + pl.ylabel("E(R)/Z") ax = pl.gca() ax.set_xlim([-episode_len/10, episode_len]) ax.set_ylim([0, 1])