class_docstr: Base class for Gaussian processes. 
class_docstr_tok: ["Base","class","for","Gaussian","processes","."]
docstr: Visualises the GP. 
docstr_tok: ["Visualises","the","GP","."]
code: def visualise(
      self,
      file_name=None,
      boundary=None,
      true_func=None,
      num_samples=20,
      conf_width=3,
  ):
      """Visualises the GP."""
      # pylint: disable=unused-variable
      # pylint: disable=too-many-locals
      if hasattr(self.kernel, "dim") and self.kernel.dim != 1:
          self._write_message("Cannot visualise only in 1 dimension.\n")
      else:
          import matplotlib.pyplot as plt
  
          fig = plt.figure()
          N = 400
          leg_handles = []
          leg_labels = []
          if not boundary:
              boundary = [min(self.X), max(self.X)]
          grid = np.linspace(boundary[0], boundary[1], N).reshape(
              (N, 1)
          )
          (pred_vals, pred_stds) = self.eval(grid, "std")
          # Shade a high confidence region
          conf_band_up = pred_vals + conf_width * pred_stds
          conf_band_down = pred_vals - conf_width * pred_stds
          leg_conf = plt.fill_between(
              grid.ravel(),
              conf_band_up,
              conf_band_down,
              color=[0.9, 0.9, 0.9],
          )
          # Plot the samples
          gp_samples = self.draw_samples(num_samples, grid)
          plt.plot(grid, gp_samples.T, "--", linewidth=0.5)
          # plot the true function if available.
          if true_func:
              leg_true = plt.plot(
                  grid,
                  true_func(grid),
                  "b--",
                  linewidth=3,
                  label="true function",
              )
              leg_handles.append(leg_true)
          # Plot the posterior mean
          leg_post_mean = plt.plot(
              grid, pred_vals, "k-", linewidth=4, label="post mean"
          )
          # Finally plot the training data.
          leg_data = plt.plot(
              self.X, self.Y, "kx", mew=4, markersize=10, label="data"
          )
          # Finally either plot or show the figure
          if file_name is None:
              plt.show()
          else:
              fig.savefig(file_name)
  
imports: from __future__ import division
  from argparse import Namespace
  from itertools import product
  import sys
  import numpy
  from ..distributions.model import Model
  from ..distributions import continuous
  from ..distributions import discrete
  from ..utils.general_utils import stable_cholesky, draw_gaussian_samples, project_symmetric_to_psd_cone, solve_lower_triangular, solve_upper_triangular
  from ..utils.oper_utils import direct_ft_maximise, pdoo_maximise, random_maximise, random_sample_cts_dscr
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 17 for calling the GP obj's underlying member method code with example usage: obj.visualise(file_name, boundary, true_func, num_samples, conf_width) without return types