improved plot

This commit is contained in:
2024-06-25 08:07:43 +02:00
parent 7836541a49
commit b2cbeae9a4
+7 -3
View File
@@ -45,15 +45,15 @@ def test(episode_len: int, epsilon: float, qu: np.array, nu: np.array, bandit: C
if __name__ == '__main__':
epsilon = 0.1 # Anti-greediness
rho = 0.01 # reduce epsilon with age
epsilon = 0.5 # Anti-greediness
rho = 0.005 # reduce epsilon with age
# 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])
num_realisations = 10
episode_len = 1000
episode_len = 10000
r_mean = np.zeros(episode_len)
for age in range(0, num_realisations):
# Init Q and N
@@ -68,4 +68,8 @@ if __name__ == '__main__':
pl.plot(r_mean/num_realisations)
pl.grid()
ax = pl.gca()
ax.set_xlim([-episode_len/10, episode_len])
ax.set_ylim([0, 1])
pl.show()