code: def learning_curves_plot(
      train_values,
      vali_values,
      metric,
      x_label="epoch",
      x_step=1,
      algorithm_names=None,
      title=None,
      filename=None,
      callbacks=None,
  ):
      num_algorithms = len(train_values)
      max_len = max(len(tv) for tv in train_values)
  
      fig, ax = plt.subplots()
  
      sns.set_style("whitegrid")
  
      if title is not None:
          ax.set_title(title)
  
      if num_algorithms == 1:
          colors = plt.get_cmap("tab10").colors
      else:  # num_algorithms > 1
          colors = plt.get_cmap("tab20").colors
  
      ax.grid(which="both")
      ax.grid(which="minor", alpha=0.5)
      ax.grid(which="major", alpha=0.75)
      ax.set_xlabel(x_label)
      ax.set_ylabel(metric.replace("_", " "))
  
      xs = np.arange(1, (max_len * x_step) + 1, x_step)
  
      for i in range(num_algorithms):
          name_prefix = (
              algorithm_names[i] + " "
              if algorithm_names is not None
              and i < len(algorithm_names)
              else ""
          )
          ax.plot(
              xs[: len(train_values[i])],
              train_values[i],
              label=name_prefix + TRAINING,
              color=colors[i * 2],
              linewidth=3,
          )
          if (
              i < len(vali_values)
              and vali_values[i] is not None
              and len(vali_values[i]) > 0
          ):
              ax.plot(
                  xs[: len(vali_values[i])],
                  vali_values[i],
                  label=name_prefix + VALIDATION,
                  color=colors[i * 2 + 1],
                  linewidth=3,
              )
  
      ax.legend()
      plt.tight_layout()
      visualize_callbacks(callbacks, plt.gcf())
      if filename:
          plt.savefig(filename)
      else:
          plt.show()
  
imports: import copy
  import logging
  from collections import Counter
  from sys import platform
  from typing import Dict, List
  import numpy
  import pandas
  import ptitprince
  from packaging import version
  from ludwig.constants import SPACE, TRAINING, VALIDATION
label_desc: Use image node_id 2 for calling a global function with example usage: learning_curves_plot(train_values, vali_values, metric, x_label, x_step, algorithm_names, title, filename, callbacks) without return types