File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,16 +39,18 @@ def save_animation(frames, filename):
3939
4040
4141def plot_running_avg (scores , env , metrics ):
42- avg_scores = np .zeros_like (scores )
4342 avg_q_values = [m ["average_q_value" ] for m in metrics ]
43+ run_avg_scores = np .zeros_like (scores )
44+ run_avg_qvals = np .zeros_like (avg_q_values )
4445
4546 for i in range (len (scores )):
46- avg_scores [i ] = np .mean (scores [max (0 , i - 100 ) : i + 1 ])
47+ run_avg_scores [i ] = np .mean (scores [max (0 , i - 100 ) : i + 1 ])
48+ run_avg_qvals [i ] = np .mean (avg_q_values [max (0 , i - 100 ) : i + 1 ])
4749
4850 plt .figure (figsize = (10 , 5 ))
49- plt .plot (avg_scores , label = "Average Score" )
50- plt .plot (avg_q_values , label = "Average Q Value" )
51- plt .title ("Running Avg Score per 100 Games vs Avg Q Value " )
51+ plt .plot (run_avg_scores , label = "Average Score" )
52+ plt .plot (run_avg_qvals , label = "Average Q Value" )
53+ plt .title ("Running Avg Scores vs Qvals per 100 Games" )
5254 plt .xlabel ("Episode" )
5355 plt .ylabel ("Value" )
5456 plt .legend ()
You can’t perform that action at this time.
0 commit comments