'Plots the cumulative rewards received as the model was trained.
If image_name is None, should be used in jupyter notebook. If
called outside of jupyter, execution of the program will halt and
a pop-up with the graph will appear. Execution will not continue
until the pop-up is closed.
Args:
image_name: Name to use when saving the plot to a file. If not
provided, image will be shown immediately.
directory: Path to directory where figure should be saved. If
None, defaults to self.output_dir.'

def plot_rewards(self, image_name=None, directory=None):

    if (directory is None):
        directory = self.output_dir
    reward_batch = self.output_every_nth
    x = [(reward_batch * i) for i in np.arange(len(self.rewards_batched))]
    plt.figure()
    plt.plot(x, self.rewards_batched)
    plt.plot(x, self.music_theory_rewards_batched)
    plt.plot(x, self.note_rnn_rewards_batched)
    plt.xlabel('Training    epoch')
    plt.ylabel((('Cumulative    reward    for    last    ' + str(reward_batch)) + '    steps'))
    plt.legend(['Total', 'Music    theory', 'Note    RNN'], loc='best')
    if (image_name is not None):
        plt.savefig(((directory + '/') + image_name))
    else:
        plt.show()
