code: def plot_error_per_epoch(train, valid, ax, logx=False):
      valid = valid[["epoch", "value"]]
      train = train[["epoch", "value"]]
  
      train_epochs = train.groupby("epoch").agg({"value": "first"})
      valid_epochs = valid.groupby("epoch").agg({"value": "first"})
  
      plot(
          # Loss that we've obtain per each training update is calculated before
          # the update. Which means that loss represents state of the network
          # before the update.
          x_train=train_epochs.index - 1,
          y_train=train_epochs.value,
          x_valid=valid_epochs.index,
          y_valid=valid_epochs.value,
          logx=logx,
          ax=ax,
      )
  
      ax.set_ylabel("Loss")
      ax.set_xlabel("Number of training epochs passed")
  
file_path: neupy/neupy/algorithms/plots.py
imports: import pkgutil
  import warnings
  import importlib
  import matplotlib.pyplot
label_desc: Use image node_id 4 for calling a global function with example usage: plot_error_per_epoch(train, valid, ax, logx) without return types