code: def plotLoss(self, filename=None):
      
      plt.figure()
      plt.plot(self.losses.keys(), self.losses.values())
      plt.xlabel("Iteration")
      plt.ylabel("Loss")
      plt.title("Learning curve for {}".format(self))
  
      if filename is not None:
        plt.savefig(filename)
docs: Plots the loss history.
  
      :param filename    (string) Can be provided to save the figure