class_docstr: The UnifiedInformationExplainer for returning explanations for pytorch NN models.
      
class_docstr_tok: ["The","UnifiedInformationExplainer","for","returning","explanations","for","pytorch","NN","models","."]
docstr: Optimize the loss function
  :param iteration: Total optimizing iteration
  :type iteration: int
  :param lr: Learning rate
  :type lr: float
  :param show_progress: Whether to show the learn progress
  :type show_progress: bool
  :return: The regularization term calculated
  :rtype: torch.FloatTensor
docstr_tok: ["Optimize","the","loss","function",":","param","iteration",":","Total","optimizing","iteration",":","type","iteration",":","int",":","param","lr",":","Learning","rate",":","type","lr",":","float",":","param","show_progress",":","Whether","to","show","the","learn","progress",":","type","show_progress",":","bool",":","return",":","The","regularization","term","calculated",":","rtype",":","torch.FloatTensor"]
code: def _optimize(self, iteration=5000, lr=0.01, show_progress=False):
      """Optimize the loss function
      :param iteration: Total optimizing iteration
      :type iteration: int
      :param lr: Learning rate
      :type lr: float
      :param show_progress: Whether to show the learn progress
      :type show_progress: bool
      :return: The regularization term calculated
      :rtype: torch.FloatTensor
      """
      minLoss = None
      state_dict = None
      optimizer = optim.Adam(self.parameters(), lr=lr)
  
      self.train()
      func = (lambda x: x) if not show_progress else tqdm
      for _ in func(range(iteration)):
          optimizer.zero_grad()
          if self.device is not None:
              self.to(self.device)
          loss = self()
          loss.backward(retain_graph=True)
          optimizer.step()
          if minLoss is None or minLoss > loss:
              state_dict = {
                  k: self.state_dict()[k] + 0.0
                  for k in self.state_dict().keys()
              }
              minLoss = loss
      self.eval()
      self.load_state_dict(state_dict)
  
imports: import torch
  from torch import nn, optim
  from tqdm import tqdm
  import numpy
  import random
  import html
  import matplotlib.pyplot
  from IPython.core.display import display, HTML
  from interpret_text.experimental.common.base_explainer import _validate_X
  from interpret_text.experimental.common.structured_model_mixin import PureStructuredModelMixin
  from interpret_text.experimental.explanation import _create_local_explanation
  from interpret_text.experimental.common.utils_unified import _get_single_embedding, make_bert_embeddings
label_desc: Use image node_id 5 for calling the UnifiedInformationExplainer obj's underlying member method code with example usage: obj._optimize(iteration, lr, show_progress) without return types