Skip to contents

[Updated]

This function draws validation plots of a GP, DGP, or linked (D)GP emulator.

Usage

# S3 method for class 'dgp'
plot(
  x,
  x_test = NULL,
  y_test = NULL,
  dim = NULL,
  method = NULL,
  sample_size = 50,
  style = 1,
  min_max = TRUE,
  normalize = TRUE,
  color = "turbo",
  type = "points",
  verb = TRUE,
  M = 50,
  force = FALSE,
  cores = 1,
  ...
)

# S3 method for class 'lgp'
plot(
  x,
  x_test = NULL,
  y_test = NULL,
  dim = NULL,
  method = NULL,
  sample_size = 50,
  style = 1,
  min_max = TRUE,
  color = "turbo",
  type = "points",
  M = 50,
  verb = TRUE,
  force = FALSE,
  cores = 1,
  ...
)

# S3 method for class 'gp'
plot(
  x,
  x_test = NULL,
  y_test = NULL,
  dim = NULL,
  method = NULL,
  sample_size = 50,
  style = 1,
  min_max = TRUE,
  color = "turbo",
  type = "points",
  verb = TRUE,
  M = 50,
  force = FALSE,
  cores = 1,
  ...
)

Arguments

x

can be one of the following emulator classes:

  • the S3 class gp.

  • the S3 class dgp.

  • the S3 class lgp.

x_test

same as that of validate().

y_test

same as that of validate().

dim

[Updated] if dim = NULL, the index of an emulator's input within the design will be shown on the x-axis in validation plots. Otherwise, dim indicates which dimension of an emulator's input will be shown on the x-axis in validation plots:

  • If x is an instance of the gp of dgp class, dim is an integer.

  • [Deprecated] If x is an instance of the lgp class created by lgp() without specifying the struc argument in data frame form, dim can be:

    1. an integer referring to the dimension of the global input to emulators in the first layer of a linked emulator system; or

    2. a vector of three integers referring to the dimension (specified by the third integer) of the global input to an emulator (specified by the second integer) in a layer (specified by the first integer) that is not the first layer of a linked emulator system.

    This option for linked (D)GP emulators is deprecated and will be removed in the next release.

  • [New] If x is an instance of the lgp class created by lgp() with argument struc in data frame form, dim is an integer referring to the dimension of the global input to the linked emulator system.

This argument is only used when style = 1. Defaults to NULL.

method

same as that of validate().

sample_size

same as that of validate().

style

either 1 or 2, indicating two different plotting styles for validation.

min_max

a bool indicating if min-max normalization will be used to scale the testing output, RMSE, predictive mean and std from the emulator. Defaults to TRUE. This argument is not applicable to DGP emulators with categorical likelihoods.

normalize

[New] a bool indicating if normalization will be used to scale the counts in validation plots of DGP emulators with categorical likelihoods when style = 2. Defaults to TRUE.

color

a character string indicating the color map to use when style = 2:

  • 'magma' (or 'A')

  • 'inferno' (or 'B')

  • 'plasma' (or 'C')

  • 'viridis' (or 'D')

  • 'cividis' (or 'E')

  • 'rocket' (or 'F')

  • 'mako' (or 'G')

  • 'turbo' (or 'H')

Defaults to 'turbo' (or 'H').

type

either 'line' or 'points, indicating whether to draw testing data in the OOS validation plot as a line or individual points when the input of the emulator is one-dimensional and style = 1. This argument is not applicable to DGP emulators with categorical likelihoods. Defaults to 'points'

verb

a bool indicating if trace information on plotting will be printed during execution. Defaults to TRUE.

M

[New] same as that of validate().

force

same as that of validate().

cores

same as that of validate().

...

N/A.

Value

A patchwork object.

Details

See further examples and tutorials at https://mingdeyu.github.io/dgpsi-R/.

Note

  • plot() calls validate() internally to obtain validation results for plotting. However, plot() will not export the emulator object with validation results. Instead, it only returns the plotting object. For small-scale validations (i.e., small training or testing data points), direct execution of plot() works well. However, for moderate- to large-scale validation, it is recommended to first run validate() to obtain and store validation results in the emulator object, and then supply the object to plot(). plot() checks the object's loo and oos slots prior to calling validate() and will not perform further calculation if the required information is already stored.

  • plot() will only use stored OOS validation if x_test and y_test are identical to those used by validate() to produce the data contained in the object's oos slot, otherwise plot() will re-evaluate OOS validation before plotting.

  • The returned patchwork::patchwork object contains the ggplot2::ggplot2 objects. One can modify the included individual ggplots by accessing them with double-bracket indexing. See https://patchwork.data-imaginist.com/ for further information.

Examples

if (FALSE) { # \dontrun{

# See gp(), dgp(), or lgp() for an example.
} # }