code: def SequenceDNN_learning_curve(dnn):
      if dnn.valid_metrics is not None:
          train_losses, valid_losses = [
              np.array(
                  [epoch_metrics["Loss"] for epoch_metrics in metrics]
              )
              for metrics in (dnn.train_metrics, dnn.valid_metrics)
          ]
          min_loss_indx = min(
              enumerate(valid_losses), key=lambda x: x[1]
          )[0]
          f = plt.figure(figsize=(10, 4))
          ax = f.add_subplot(1, 1, 1)
          ax.plot(
              range(len(train_losses)),
              train_losses,
              "b",
              label="Training",
              lw=4,
          )
          ax.plot(
              range(len(train_losses)),
              valid_losses,
              "r",
              label="Validation",
              lw=4,
          )
          ax.plot(
              [min_loss_indx, min_loss_indx],
              [0, 1.0],
              "k--",
              label="Early Stop",
          )
          ax.legend(loc="upper right")
          ax.set_ylabel("Loss")
          ax.set_ylim((0.0, 1.0))
          ax.set_xlabel("Epoch")
          plt.show()
      else:
          print("learning curve can only be obtained after training!")
  
file_path: deepchem/contrib/dragonn/tutorial_utils.py
imports: from __future__ import division
  import random
  import inspect
  from collections import namedtuple, defaultdict, OrderedDict
  import numpy
  from sklearn.model_selection import train_test_split
  import simulations
  from simdna.synthetic import StringEmbeddable
  from utils import get_motif_scores, one_hot_encode
  from models import SequenceDNN
  from dragonn.plot import add_letters_to_axis, plot_motif
  import matplotlib.pyplot
  from matplotlib.lines import Line2D
label_desc: Use image node_id 1 for calling a global function with example usage: SequenceDNN_learning_curve(dnn) without return types