class_docstr: ```
  Tracks (and plots) the change in loss of a Keras model as learning rate is gradually increased.
  Used to visually identify a good learning rate, given model and data.
  Reference:
      Original Paper: https://arxiv.org/abs/1506.01186
  ```
class_docstr_tok: ["``","`","Tracks","(","and","plots",")","the","change","in","loss","of","a","Keras","model","as","learning","rate","is","gradually","increased",".","Used","to","visually","identify","a","good","learning","rate",",","given","model","and","data",".","Reference",":","Original","Paper",":","https",":","\/\/arxiv.org\/abs\/1506.01186","``","`"]
docstr: ```
  Plots the loss.
  Args:
      n_skip_beginning(int): number of batches to skip on the left.
      n_skip_end(int):  number of batches to skip on the right.
      suggest(bool): will highlight numerical estimate
                     of best lr if True - methods adapted from fastai
      return_fig(bool):  If True, return matplotlib.figure.Figure
  Returns:
    matplotlib.figure.Figure if return_fig else None
  ```
docstr_tok: ["``","`","Plots","the","loss",".","Args",":","n_skip_beginning","(","int",")",":","number","of","batches","to","skip","on","the","left",".","n_skip_end","(","int",")",":","number","of","batches","to","skip","on","the","right",".","suggest","(","bool",")",":","will","highlight","numerical","estimate","of","best","lr","if","True","-","methods","adapted","from","fastai","return_fig","(","bool",")",":","If","True",",","return","matplotlib.figure.Figure","Returns",":","matplotlib.figure.Figure","if","return_fig","else","None","``","`"]
code: def plot_loss(
      self,
      n_skip_beginning=10,
      n_skip_end=1,
      suggest=False,
      return_fig=False,
  ):
      """
      ```
      Plots the loss.
      Args:
          n_skip_beginning(int): number of batches to skip on the left.
          n_skip_end(int):  number of batches to skip on the right.
          suggest(bool): will highlight numerical estimate
                         of best lr if True - methods adapted from fastai
          return_fig(bool):  If True, return matplotlib.figure.Figure
      Returns:
        matplotlib.figure.Figure if return_fig else None
      ```
      """
      if not self.find_called:
          raise ValueError("Please call find first.")
  
      fig, ax = plt.subplots()
      plt.ylabel("loss")
      plt.xlabel("learning rate (log scale)")
      ax.plot(
          self.lrs[n_skip_beginning:-n_skip_end],
          self.losses[n_skip_beginning:-n_skip_end],
      )
      plt.xscale("log")
  
      fig = None
      if suggest:
          # this code was adapted from fastai: https://github.com/fastai/fastai
          if self.mg is None:
              print(
                  "Failed to compute the gradients, there might not be enough points.\n"
                  + "Plot displayed without suggestion."
              )
          else:
              valley = self.valley(self.lrs, self.losses)
              mg = self.mg
              ml = self.ml
              print("Three possible suggestions for LR from plot:")
              print(f"\tLongest valley (red): {self.lrs[valley]:.2E}")
              print(
                  f"\tMin numerical gradient (purple): {self.lrs[mg]:.2E}"
              )
              print(
                  f"\tMin loss divided by 10 (omitted from plot): {self.lrs[ml]/10:.2E}"
              )
              ax.plot(
                  self.lrs[valley],
                  self.losses[valley],
                  markersize=10,
                  marker="o",
                  color="red",
              )
              ax.plot(
                  self.lrs[mg],
                  self.losses[mg],
                  markersize=10,
                  marker="o",
                  color="purple",
              )
      fig = plt.gcf()
      plt.show()
      if return_fig:
          return fig
      return
  
file_path: ktrain/ktrain/lroptimize/lrfinder.py
imports: from ..None import utils
  from ..imports import *
label_desc: Use image node_id 4 for calling the LRFinder obj's underlying member method code with example usage: obj.plot_loss(n_skip_beginning, n_skip_end, suggest, return_fig) and returns: fig