validate | R Documentation |
This function calculates Leave-One-Out (LOO) cross validation or Out-Of-Sample (OOS) validation statistics for a constructed GP, DGP, or linked (D)GP emulator.
validate(
object,
x_test,
y_test,
method,
sample_size,
verb,
M,
force,
cores,
...
)
## S3 method for class 'gp'
validate(
object,
x_test = NULL,
y_test = NULL,
method = NULL,
sample_size = 50,
verb = TRUE,
M = 50,
force = FALSE,
cores = 1,
...
)
## S3 method for class 'dgp'
validate(
object,
x_test = NULL,
y_test = NULL,
method = NULL,
sample_size = 50,
verb = TRUE,
M = 50,
force = FALSE,
cores = 1,
...
)
## S3 method for class 'lgp'
validate(
object,
x_test = NULL,
y_test = NULL,
method = NULL,
sample_size = 50,
verb = TRUE,
M = 50,
force = FALSE,
cores = 1,
...
)
See further examples and tutorials at https://mingdeyu.github.io/dgpsi-R/.
If object
is an instance of the gp
class, an updated object
is returned with an additional slot called loo
(for LOO cross validation) or
oos
(for OOS validation) that contains:
two slots called x_train
(or x_test
) and y_train
(or y_test
) that contain the validation data points for LOO (or OOS).
a column matrix called mean
, if method = "mean_var"
, or median
, if method = "sampling"
, that contains the predictive means or medians of the
GP emulator at validation positions.
three column matrices called std
, lower
, and upper
that contain the predictive standard deviations and credible intervals of the
GP emulator at validation positions. If method = "mean_var"
, the upper and lower bounds of a credible interval are two standard deviations above
and below the predictive mean. If method = "sampling"
, the upper and lower bounds of a credible interval are 2.5th and 97.5th percentiles.
a numeric value called rmse
that contains the root mean/median squared error of the GP emulator.
a numeric value called nrmse
that contains the (max-min) normalized root mean/median squared error of the GP emulator. The max-min normalization
uses the maximum and minimum values of the validation outputs contained in y_train
(or y_test
).
an integer called
M
that contains the size of the conditioning set used for the Vecchia approximation, if used, for emulator validation.
an integer called sample_size
that contains the number of samples used for validation if method = "sampling"
.
The rows of matrices (mean
, median
, std
, lower
, and upper
) correspond to the validation positions.
If object
is an instance of the dgp
class, an updated object
is returned with an additional slot called loo
(for LOO cross validation) or
oos
(for OOS validation) that contains:
two slots called x_train
(or x_test
) and y_train
(or y_test
) that contain the validation data points for LOO (or OOS).
a matrix called mean
, if method = "mean_var"
, or median
, if method = "sampling"
, that contains the predictive means or medians of the
DGP emulator at validation positions.
three matrices called std
, lower
, and upper
that contain the predictive standard deviations and credible intervals of the
DGP emulator at validation positions. If method = "mean_var"
, the upper and lower bounds of a credible interval are two standard deviations above
and below the predictive mean. If method = "sampling"
, the upper and lower bounds of a credible interval are 2.5th and 97.5th percentiles.
a vector called rmse
that contains the root mean/median squared errors of the DGP emulator across different output
dimensions.
a vector called nrmse
that contains the (max-min) normalized root mean/median squared errors of the DGP emulator across different output
dimensions. The max-min normalization uses the maximum and minimum values of the validation outputs contained in y_train
(or y_test
).
an integer called
M
that contains size of the conditioning set used for the Vecchia approximation, if used, for emulator validation.
an integer called sample_size
that contains the number of samples used for validation if method = "sampling"
.
The rows and columns of matrices (mean
, median
, std
, lower
, and upper
) correspond to the validation positions and DGP emulator output
dimensions, respectively.
If
object
is an instance of the dgp
class with a categorical likelihood, an updated object
is returned with an additional slot called loo
(for LOO cross validation) or oos
(for OOS validation) that contains:
two slots called x_train
(or x_test
) and y_train
(or y_test
) that contain the validation data points for LOO (or OOS).
a matrix called label
that contains predictive samples of labels from the DGP emulator at validation positions. The matrix has its rows
corresponding to validation positions and columns corresponding to samples of labels.
a list called probability
that contains predictive samples of probabilities for each class from the DGP emulator at validation positions. The element in the list
is a matrix that has its rows corresponding to validation positions and columns corresponding to samples of probabilities.
a scalar called log_loss
that represents the average log loss of the predicted labels in the DGP emulator across all validation positions. Log loss measures the
accuracy of probabilistic predictions, with lower values indicating better classification performance. log_loss
ranges from 0
to positive infinity, where a
value closer to 0
suggests more confident and accurate predictions.
an integer called M
that contains size of the conditioning set used for the Vecchia approximation, if used, in emulator validation.
an integer called sample_size
that contains the number of samples used for validation.
If object
is an instance of the lgp
class, an updated object
is returned with an additional slot called oos
(for OOS validation) that contains:
two slots called x_test
and y_test
that contain the validation data points for OOS.
a list called mean
, if method = "mean_var"
, or median
, if method = "sampling"
, that contains the predictive means or medians of
the linked (D)GP emulator at validation positions.
three lists called std
, lower
, and upper
that contain the predictive standard deviations and credible intervals of
the linked (D)GP emulator at validation positions. If method = "mean_var"
, the upper and lower bounds of a credible interval are two standard
deviations above and below the predictive mean. If method = "sampling"
, the upper and lower bounds of a credible interval are 2.5th and 97.5th percentiles.
a list called rmse
that contains the root mean/median squared errors of the linked (D)GP emulator.
a list called nrmse
that contains the (max-min) normalized root mean/median squared errors of the linked (D)GP emulator. The max-min normalization
uses the maximum and minimum values of the validation outputs contained in y_test
.
an integer called
M
that contains size of the conditioning set used for the Vecchia approximation, if used, in emulator validation.
an integer called sample_size
that contains the number of samples used for validation if method = "sampling"
.
Each element in mean
, median
, std
, lower
, upper
, rmse
, and nrmse
corresponds to a (D)GP emulator in the final layer of the linked (D)GP
emulator.
When both x_test
and y_test
are NULL
, LOO cross validation will be implemented. Otherwise, OOS validation will
be implemented. LOO validation is only applicable to a GP or DGP emulator (i.e., object
is an instance of the gp
or dgp
class). If a linked (D)GP emulator (i.e., object
is an instance of the lgp
class) is provided, x_test
and y_test
must
also be provided for OOS validation.
## 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.