Estimation/training of random effects models and Gaussian process (GP) models, in particular, can be computationally demanding for large data (not just in GPBoost). Below, we list some strategies for computationally efficient inference.
In brief, try:
GPModel(..., gp_approx = "vecchia")
for Gaussian process modelsGPModel(..., gp_approx = "vecchia", matrix_inversion_method = "iterative")
for Gaussian processes with non-Gaussian likelihoods (e.g., classification)
In more detail:
The GPBoost library implements Vecchia approximations for Gaussian processes. To activate this, set
gp_approx = "vecchia"
. The parameternum_neighbors
controls a trade-off between runtime and accuracy. The smaller thenum_neighbors
, the faster the code will run. See here for more information on the methodological background.- For non-Gaussian likelihoods (e.g., classification), iterative methods (instead of the Cholesky decomposition) can additionally speed-up computations with a Vecchia approximation:
GPModel(..., gp_approx = "vecchia", matrix_inversion_method = "iterative")
. - Additional speed-up for
matrix_inversion_method = "iterative"
can sometimes be obtained by setting thecg_max_num_it
to a lower value, say, 100 or 20 (default = 1000). This can be done by calling theset_optim_params
function prior to running the GPBoost algorithm or by setting this in theparams
argument when training a GPModel. This option particularly recommended for the GPBoost algorithm.
- For non-Gaussian likelihoods (e.g., classification), iterative methods (instead of the Cholesky decomposition) can additionally speed-up computations with a Vecchia approximation:
The GPBoost library also imports other GP approximations; see here (
gp_approx
) for a list of currently supported approximations
Setting the parameter
train_gp_model_cov_pars
to false in the functiongpb.train
can make training faster for the GPBoost algorithm as covariance parameters are not trained. In this case, you can consider them as tuning parameters that can be chosen using, e.g., cross-validation. As a middle ground, you can also increase the convergence tolerance for the hyperparameter estimation. This means that hyperparameters are estimated less accurately but faster. Examples:gpb.train(..., train_gp_model_cov_pars=FALSE))
(R) /gpb.train(..., train_gp_model_cov_pars=False)
(Python)gp_model$set_optim_params(params=list(delta_rel_conv=1e-3))
(R) /gp_model.set_optim_params(params={"delta_rel_conv": 1e-3})
(Python)
To get a better understanding of the progress of the hyperparameter optimization, set the option
trace
to true in thegp_model
. Examples:gp_model$set_optim_params(params=list(trace=TRUE))
(R) /gp_model.set_optim_params(params={"trace": True})
(Python)