code: def plot_2d_kernel_prediction(
      ax: Axes, kernel: gpflow.kernels.Kernel
  ) -> None:
      n_grid = 30
      # hide: begin
      # fmt: off
      # hide: end
      X = np.array(
          [
              [-0.4, -0.5], [0.1, -0.3], [0.4, -0.4], [0.5, -0.5], [-0.5, 0.3],
              [0.0, 0.5], [0.4, 0.4], [0.5, 0.3],
          ]
      )
      Y = np.array([[0.8], [0.0], [0.5], [0.3], [1.0], [0.2], [0.7], [0.5]])
      # hide: begin
      # fmt: on
      # hide: end
      model = gpflow.models.GPR(
          (X, Y), kernel=deepcopy(kernel), noise_variance=1e-3
      )
      gpflow.set_trainable(model.likelihood, False)
      opt = gpflow.optimizers.Scipy()
      opt.minimize(model.training_loss, model.trainable_variables)
  
      Xplots = np.linspace(-0.6, 0.6, n_grid)
      Xplot1, Xplot2 = np.meshgrid(Xplots, Xplots)
      Xplot = np.stack([Xplot1, Xplot2], axis=-1)
      Xplot = Xplot.reshape([n_grid**2, 2])
  
      f_mean, _ = model.predict_f(Xplot, full_cov=False)
      f_mean = f_mean.numpy().reshape((n_grid, n_grid))
      ax.plot_surface(Xplot1, Xplot2, f_mean, cmap=coolwarm, alpha=0.7)
      ax.scatter(X[:, 0], X[:, 1], Y[:, 0], s=50, c="black")
      ax.set_title("Example data fit")
  
file_path: GPflow/doc/sphinx/notebooks/getting_started/kernels.pct.py
imports: import os
  import warnings
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from matplotlib.axes import Axes
  from matplotlib.cm import coolwarm
  import gpflow
label_desc: Use image node_id 6 for calling a global function with example usage: plot_2d_kernel_prediction(ax, kernel) without return types