code: def plot_convergence(Xdata, best_Y, filename=None):
      """
      Plots to evaluate the convergence of standard Bayesian optimization algorithms
      """
      n = Xdata.shape[0]
      aux = (Xdata[1:n, :] - Xdata[0 : n - 1, :]) ** 2
      distances = np.sqrt(aux.sum(axis=1))
  
      ## Distances between consecutive x's
      plt.figure(figsize=(10, 5))
      plt.subplot(1, 2, 1)
      plt.plot(list(range(n - 1)), distances, "-ro")
      plt.xlabel("Iteration")
      plt.ylabel("d(x[n], x[n-1])")
      plt.title("Distance between consecutive x's")
      grid(True)
  
      # Estimated m(x) at the proposed sampling points
      plt.subplot(1, 2, 2)
      plt.plot(list(range(n)), best_Y, "-o")
      plt.title("Value of the best selected sample")
      plt.xlabel("Iteration")
      plt.ylabel("Best y")
      grid(True)
  
      if filename != None:
          savefig(filename)
      else:
          plt.show()
  
imports: import numpy
  from pylab import grid
  import matplotlib.pyplot
  from pylab import savefig
  import pylab
label_desc: Use image node_id 2 for calling a global function with example usage: plot_convergence(Xdata, best_Y, filename) without return types