improved plot
This commit is contained in:
+7
-3
@@ -45,15 +45,15 @@ def test(episode_len: int, epsilon: float, qu: np.array, nu: np.array, bandit: C
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
epsilon = 0.1 # Anti-greediness
|
epsilon = 0.5 # Anti-greediness
|
||||||
rho = 0.01 # reduce epsilon with age
|
rho = 0.005 # reduce epsilon with age
|
||||||
|
|
||||||
# init bandits with different biases for shifting reward probability
|
# init bandits with different biases for shifting reward probability
|
||||||
# -> expected reward q*(a)
|
# -> 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([-0.4, -0.3, -0.2, -0.1, 0.0, +0.1, +0.2, +0.3, +0.4, +0.5])
|
||||||
|
|
||||||
num_realisations = 10
|
num_realisations = 10
|
||||||
episode_len = 1000
|
episode_len = 10000
|
||||||
r_mean = np.zeros(episode_len)
|
r_mean = np.zeros(episode_len)
|
||||||
for age in range(0, num_realisations):
|
for age in range(0, num_realisations):
|
||||||
# Init Q and N
|
# Init Q and N
|
||||||
@@ -68,4 +68,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
pl.plot(r_mean/num_realisations)
|
pl.plot(r_mean/num_realisations)
|
||||||
pl.grid()
|
pl.grid()
|
||||||
|
ax = pl.gca()
|
||||||
|
ax.set_xlim([-episode_len/10, episode_len])
|
||||||
|
ax.set_ylim([0, 1])
|
||||||
|
|
||||||
pl.show()
|
pl.show()
|
||||||
|
|||||||
Reference in New Issue
Block a user