predict {dgpsi}R Documentation

Prediction from GP, DGP, or linked (D)GP emulators

Description

[Updated]

This function implements prediction from GP, DGP, or linked (D)GP emulators.

Usage

## S3 method for class 'dgp'
predict(
  object,
  x,
  method = NULL,
  mode = "label",
  full_layer = FALSE,
  sample_size = 50,
  M = 50,
  cores = 1,
  chunks = NULL,
  ...
)

## S3 method for class 'lgp'
predict(
  object,
  x,
  method = NULL,
  full_layer = FALSE,
  sample_size = 50,
  M = 50,
  cores = 1,
  chunks = NULL,
  ...
)

## S3 method for class 'gp'
predict(
  object,
  x,
  method = NULL,
  sample_size = 50,
  M = 50,
  cores = 1,
  chunks = NULL,
  ...
)

Arguments

object

an instance of the gp, dgp, or lgp class.

x

the testing input data:

  • if object is an instance of the gp or dgp class, x is a matrix where each row is an input testing data point and each column is an input dimension.

  • [Deprecated] if object is an instance of the lgp class created by lgp() without specifying argument struc in data frame form, x can be either a matrix or a list:

    • if x is a matrix, its rows are treated as instances of the Global inputs. In this case, it is assumed that the only global input to the system is the input to the emulators in the first layer and there is no global input to emulators in other layers.

    • if x is a list, it should have L (the number of layers in an emulator system) elements. The first element is a matrix that represents the global testing input data that feed into the emulators in the first layer of the system. The remaining L-1 elements are L-1 sub-lists, each of which contains a number (the same number of emulators in the corresponding layer) of matrices (rows being testing input data points and columns being input dimensions) that represent the global testing input data to the emulators in the corresponding layer. The matrices must be placed in the sub-lists based on how their corresponding emulators are placed in struc argument of lgp(). If there is no global input data to a certain emulator, set NULL in the corresponding sub-list of x.

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

  • [New] If object is an instance of the lgp class created by lgp() with argument struc in data frame form, x must be a matrix representing the global input, where each row corresponds to a test data point and each column represents a global input dimension. The column indices in x must align with the indices specified in the From_Output column of the struc data frame (used in lgp()), corresponding to rows where the From_Emulator column is "Global".

method

[Updated] the prediction approach to use: either the mean-variance approach ("mean_var") or the sampling approach ("sampling"). The mean-variance approach returns the means and variances of the predictive distributions, while the sampling approach generates samples from predictive distributions using the derived means and variances. For DGP emulators with a categorical likelihood (likelihood = "Categorical" in dgp()), method is only applicable when full_layer = TRUE. In this case, the sampling approach generates samples from the GP nodes in all hidden layers using the derived means and variances, and subsequently propagates these samples through the categorical likelihood. By default, the method is set to "sampling" for DGP emulators with Poisson, Negative Binomial, and Categorical likelihoods, and to "mean_var" otherwise.

mode

[New] whether to predict the classes ("label") or probabilities ("proba") of different classes when object is a DGP emulator with a categorical likelihood. Defaults to "label".

full_layer

a bool indicating whether to output the predictions of all layers. Defaults to FALSE. Only used when object is a DGP or a linked (D)GP emulator.

sample_size

the number of samples to draw for each given imputation if method = "sampling". Defaults to 50.

M

[New] the size of the conditioning set for the Vecchia approximation in the emulator prediction. Defaults to 50. This argument is only used if the emulator object was constructed under the Vecchia approximation.

cores

the number of processes to be used for prediction. If set to NULL, the number of processes is set to ⁠max physical cores available %/% 2⁠. Defaults to 1.

chunks

the number of chunks that the testing input matrix x will be divided into for multi-cores to work on. Only used when cores is not 1. If not specified (i.e., chunks = NULL), the number of chunks is set to the value of cores. Defaults to NULL.

...

N/A.

Details

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

Value

The results slot will also include:

Examples

## Not run: 

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

## End(Not run)

[Package dgpsi version 2.5.0 Index]