code: def plot_loss(self, n_skip=10, n_skip_end=5):
          '''
          plots loss function as function of iterations. 
          When used in Jupyternotebook, plot will be displayed in notebook. Else, plot will be displayed in console and both plot and loss are saved in save_path. 
          '''
          if not in_ipynb(): plt.switch_backend('agg')
          plt.plot(self.iterations[n_skip:-n_skip_end], self.losses[n_skip:-n_skip_end])
          if not in_ipynb():
              plt.savefig(os.path.join(self.save_path, 'loss_plot.png'))
              np.save(os.path.join(self.save_path, 'losses.npy'), self.losses[10:]f plot_loss(self, n_skip=10, n_skip_end=5):
          '''
          plots loss function as function of iterations. 
          When used in Jupyternotebook, plot will be displayed in notebook. Else, plot will be displayed in console and both plot and loss are saved in save_path. 
          '''
          if not in_ipynb(): plt.switch_backend('agg')
          plt.plot(self.iterations[n_skip:-n_skip_end], self.losses[n_skip:-n_skip_end])
          if not in_ipynb():
              plt.savefig(os.path.join(self.save_path, 'loss_plot.png'))
              np.save(os.path.join(self.save_path, 'losses.npy'), self.losses[10:])
docs: plots loss function as function of iterations. 
          When used in Jupyternotebook, plot will be displayed in notebook. Else, plot will be displayed in console and both plot and loss are saved in save_path.