predict | R Documentation |
This function implements prediction from GP, DGP, or linked (D)GP emulators.
## 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,
...
)
See further examples and tutorials at https://mingdeyu.github.io/dgpsi-R/.
If object
is an instance of the gp
class:
if method = "mean_var"
: an updated object
is returned with an additional slot called results
that contains two matrices named mean
for the predictive means and var
for the predictive variances. Each matrix has only one column with its rows
corresponding to testing positions (i.e., rows of x
).
if method = "sampling"
: an updated object
is returned with an additional slot called results
that contains a matrix whose rows correspond
to testing positions and columns correspond to sample_size
number of samples drawn from the predictive distribution of GP.
If object
is an instance of the dgp
class:
if method = "mean_var"
and full_layer = FALSE
: an updated object
is returned with an additional slot called results
that contains two
matrices named mean
for the predictive means and var
for the predictive variances respectively. Each matrix has its rows corresponding to testing
positions and columns corresponding to DGP global output dimensions (i.e., the number of GP/likelihood nodes in the final layer).
if method = "mean_var"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains two
sub-lists named mean
for the predictive means and var
for the predictive variances respectively. Each sub-list contains L (i.e., the number of layers)
matrices named layer1, layer2,..., layerL
. Each matrix has its rows corresponding to testing positions and columns corresponding to
output dimensions (i.e., the number of GP/likelihood nodes from the associated layer).
if method = "sampling"
and full_layer = FALSE
: an updated object
is returned with an additional slot called results
that contains D (i.e., the number
of GP/likelihood nodes in the final layer) matrices named output1, output2,..., outputD
. Each matrix has its rows corresponding to testing positions and
columns corresponding to samples of size: B * sample_size
, where B
is the number of imputations specified in dgp()
.
if method = "sampling"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains L (i.e., the number
of layers) sub-lists named layer1, layer2,..., layerL
. Each sub-list represents samples drawn from the GP/likelihood nodes in the corresponding layer,
and contains D (i.e., the number of GP/likelihood nodes in the corresponding layer) matrices named output1, output2,..., outputD
. Each matrix gives samples
of the output from one of D GP/likelihood nodes, and has its rows corresponding to testing positions and columns corresponding to samples
of size: B * sample_size
, where B
is the number of imputations specified in dgp()
.
If
object
is an instance of the dgp
class with a categorical likelihood:
if full_layer = FALSE
and mode = "label"
: an updated object
is returned with an additional slot called results
that contains one matrix named label
.
The matrix has rows corresponding to testing positions and columns corresponding to sample labels of size: B * sample_size
, where B
is the number
of imputations specified in dgp()
.
if full_layer = FALSE
and mode = "proba"
, an updated object
is returned with an additional slot called results
. This slot contains D matrices (where
D is the number of classes in the training output), where each matrix gives probability samples for the corresponding class with its rows corresponding to testing
positions and columns containing probabilities. The number of columns of each matrix is B * sample_size
, where B
is the number of imputations
specified in the dgp()
function.
if method = "mean_var"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains L (i.e., the number
of layers) sub-lists named layer1, layer2,..., layerL
. Each of first L-1
sub-lists contains two matrices named mean
for the predictive means and var
for the predictive variances of the GP nodes in the associated layer. Rows of each matrix correspond to testing positions.
when mode = "label"
, the sub-list LayerL
contains one matrix named label
. The matrix has its rows corresponding to testing positions and columns
corresponding to label samples of size: B * sample_size
. B
is the number of imputations specified in dgp()
.
when mode = "proba"
, the sub-list LayerL
contains D matrices (where D is the number of classes in the training output), where each matrix gives probability
samples for the corresponding class with its rows corresponding to testing positions and columns containing probabilities. The number of columns of each matrix
is B * sample_size
. B
is the number of imputations specified in dgp()
.
if method = "sampling"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains L (i.e., the number
of layers) sub-lists named layer1, layer2,..., layerL
. Each of first L-1
sub-lists represents samples drawn from the GP nodes in the
corresponding layer, and contains D (i.e., the number of GP nodes in the corresponding layer) matrices named output1, output2,..., outputD
. Each matrix
gives samples of the output from one of D GP nodes, and has its rows corresponding to testing positions and columns corresponding to samples
of size: B * sample_size
.
when mode = "label"
, the sub-list LayerL
contains one matrix named label
. The matrix has its rows corresponding to testing positions and columns
corresponding to label samples of size: B * sample_size
.
when mode = "proba"
, the sub-list LayerL
contains D matrices (where D is the number of classes in the training output), where each matrix gives probability
samples for the corresponding class with its rows corresponding to testing positions and columns containing probabilities. The number of columns of each matrix
is B * sample_size
.
B
is the number of imputations specified in dgp()
.
If
object
is an instance of the lgp
class:
if method = "mean_var"
and full_layer = FALSE
: an updated object
is returned with an additional slot called results
that
contains two sub-lists named mean
for the predictive means and var
for the predictive variances respectively. Each sub-list
contains K (same number of emulators in the final layer of the system) matrices named using the ID
s of the corresponding emulators in the final layer.
Each matrix has rows corresponding to global testing positions and columns corresponding to output dimensions of the associated emulator
in the final layer.
if method = "mean_var"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains
two sub-lists named mean
for the predictive means and var
for the predictive variances respectively. Each sub-list contains L
(i.e., the number of layers in the emulated system) components named layer1, layer2,..., layerL
. Each component represents a layer
and contains K (same number of emulators in the corresponding layer of the system) matrices named using the ID
s of the corresponding emulators in that layer.
Each matrix has its rows corresponding to global testing positions and columns corresponding to output dimensions of the associated
GP/DGP emulator in the corresponding layer.
if method = "sampling"
and full_layer = FALSE
: an updated object
is returned with an additional slot called results
that contains
K (same number of emulators in the final layer of the system) sub-lists named using the ID
s of the corresponding emulators in the final layer. Each
sub-list contains D matrices, named output1, output2,..., outputD
, that correspond to the output
dimensions of the GP/DGP emulator. Each matrix has rows corresponding to testing positions and columns corresponding to samples
of size: B * sample_size
, where B
is the number of imputations specified in lgp()
.
if method = "sampling"
and full_layer = TRUE
: an updated object
is returned with an additional slot called results
that contains
L (i.e., the number of layers of the emulated system) sub-lists named layer1, layer2,..., layerL
. Each sub-list represents a layer
and contains K (same number of emulators in the corresponding layer of the system) components named using the ID
s of the corresponding emulators in that layer.
Each component contains D matrices, named output1, output2,..., outputD
, that correspond to
the output dimensions of the GP/DGP emulator. Each matrix has its rows corresponding to testing positions and columns corresponding to
samples of size: B * sample_size
, where B
is the number of imputations specified in lgp()
.
If object
is an instance of the lgp
class created by lgp()
without specifying the struc
argument in data frame form, the ID
s, that are used as names of sub-lists or
matrices within results
, will be replaced by emulator1
, emulator2
, and so on.
The results
slot will also include:
the value of
M
, which represents the size of the conditioning set for the Vecchia approximation, if used, in the emulator prediction.
the value of sample_size
if method = "sampling"
.
## Not run:
# See gp(), dgp(), or lgp() for an example.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.