code: def plot(x_train, y_train, x_valid, y_valid, ax, logx=False):
      plot_function = ax.semilogx if logx else ax.plot
  
      # With large number of samples there will be to many
      # points in the plot and it will be hard to read it
      style = "-" if len(x_train) > 50 or len(x_valid) > 50 else "o-"
      (line_train,) = plot_function(
          x_train, y_train, style, label="train"
      )
  
      if len(x_valid) > 0:
          (line_valid_,) = plot_function(
              x_valid, y_valid, style, label="valid"
          )
          ax.legend(
              [line_train, line_valid_], ["Training", "Validation"]
          )
  
file_path: neupy/neupy/algorithms/plots.py
imports: import pkgutil
  import warnings
  import importlib
  import matplotlib.pyplot
label_desc: Use image node_id 2 for calling a global function with example usage: plot(x_train, y_train, x_valid, y_valid, ax, logx) without return types