R/validation.R
cross_validation.Rd
Compute the cross-validation for the ngme model Perform cross-validation for ngme model first into sub_groups (a list of target, and train data)
cross_validation(
ngme,
type = "k-fold",
seed = NULL,
print = FALSE,
N = 5,
n_gibbs_samples = 100,
n_burnin = 100,
k = 5,
percent = 0.2,
times = 10,
test_idx = NULL,
train_idx = NULL,
keep_pred = FALSE
)
a ngme object, or a list of ngme object (if comparing multiple models)
character, in c("k-fold", "loo", "lpo", "custom")
k-fold is k-fold cross-validation, provide k
loo is leave-one-out,
lpo is leave-percent-out, provide percent
from 1 to 100
custom is user-defined group, provide target
and data
random seed
print information during computation
integer, number of simulations (e.g., estimate MAE, MSE, .. N times)
number of gibbs samples
number of burnin
integer (only for k-fold type)
how many percent for testing? from 0 to 1 (for lpo type)
how many test cases (only for lpo type)
a list of indices of the data (which data points to be predicted) (only for custom type)
a list of indices of the data (which data points to be used for re-sampling (not re-estimation)) (only for custom type)
logical, keep test information (pred_1, pred_2) in the return (as attributes), pred_1 and pred_2 are the prediction of the two chains
1. mean of N estimations of 4 criterions: MSE, MAE, CRPS, sCRPS 2. standard deviation of N estimations of 4 criterions: MSE, MAE, CRPS, sCRPS