Skip to content

Commit 5117f03

Browse files
authored
refactor: add x & y labels on plots (#54)
Also change one plot to percents like in the book
1 parent c187feb commit 5117f03

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

notebooks/Chapter06_Cliff_Walking.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ end
127127

128128
# ╔═╡ 33ab57f2-4e55-11eb-3b53-89492ca4b5f6
129129
begin
130-
p = plot(legend=:bottomright)
130+
p = plot(legend=:bottomright, xlabel="Episodes", ylabel="Sum of rewards during episode")
131131
plot!(p, repeated_run(0.5, :SARS, 1000, 500, false), label="QLearning")
132132
plot!(p, repeated_run(0.5, :SARSA, 1000, 500, false), label="SARSA")
133133
p
@@ -136,7 +136,7 @@ end
136136
# ╔═╡ a9f81264-4e5b-11eb-2634-cb2179ea9e6b
137137
begin
138138
A = 0.1:0.05:0.95
139-
fig_6_3 = plot(;legend=:bottomright)
139+
fig_6_3 = plot(;legend=:bottomright, xlabel="α", ylabel="Sum of rewards per episode")
140140

141141
plot!(fig_6_3, A, [repeated_run(α, :SARS, 100, 100) for α in A], linestyle=:dash ,markershape=:rect, label="Interim Q")
142142
plot!(fig_6_3, A, [repeated_run(α, :SARSA, 100, 100) for α in A], linestyle=:dash, markershape=:dtriangle, label="Interim SARSA")

notebooks/Chapter06_Maximization_Bias.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ begin
188188
run(create_double_Q_agent(), world, StopAfterEpisode(300),hook)
189189
push!(DQ_stats, hook.counts)
190190
end
191-
plot(mean(DQ_stats), legend=:topright, label="double q")
191+
plot(mean(DQ_stats)*100, legend=:topright, label="double q", xlabel="Episodes", ylabel="% left actions from A")
192192

193193
Q_stats = []
194194
for _ in 1:1000
195195
hook = CountOfLeft()
196196
run(create_Q_agent(), world, StopAfterEpisode(300),hook)
197197
push!(Q_stats, hook.counts)
198198
end
199-
plot!(mean(Q_stats), legend=:topright, label="q")
200-
hline!([0.05], linestyle=:dash, label="optimal")
199+
plot!(mean(Q_stats)*100, legend=:topright, label="q")
200+
hline!([5], linestyle=:dash, label="optimal")
201201
end
202202

203203
# ╔═╡ 00000000-0000-0000-0000-000000000001

notebooks/Chapter07_Random_Walk.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ end
6262
# ╔═╡ 0b1b0448-522b-11eb-0264-9131eabe2525
6363
begin
6464
A = 0.:0.05:1.0
65-
p = plot()
65+
p = plot(xlabel="α", ylabel="Average RMS error")
6666
for n in [2^i for i in 0:9]
6767
avg_rms = Float64[]
6868
for α in A

0 commit comments

Comments
 (0)