WrappedmlegpGP {GPTreeO} | R Documentation |
R6 class WrappedmlegpGP
Description
Contains the GP created by mlegp::mlegp from the mlegp
package
Details
This package is by default not able to include individual uncertainties for input points. For this reason, all fields related to y_var
are not used when updating the GP. No covariance kernel can be specified either. This implementation also assumes a vector for y
(and not a matrix with multiple columns). Moreover, since no parameters can be specified for the GP, we will only update the GP parameters due to internal dependencies, but not use init_covpars
.
Public fields
gp
The mlegp GP object (mlegp::mlegp in the
mlegp
manual)X_buffer
Buffer matrix to collect x points until first GP can be trained
y_buffer
Buffer vector to collect y points until first GP can be trained
y_var_buffer
Buffer vector to collect variance of y points until first GP can be trained
add_y_var
Small additional variance used to keep the covariance matrix condition number under control
n_points_train_limit
Number of points needed before we can create the GP
n_points
The number of collected points belonging to this GP
x_dim
Dimensionality of input points
gp_control
A list of GP implementation-specific options, passed directly to the wrapped GP implementation
init_covpars
The initial covariance parameters when training the mlegp GP object in self@gp
estimate_covpars
If TRUE, the parameters are estimated by the package. Otherwise, the parameters from init_covpars are taken
retrain_buffer_length
Only retrain after this many new points have been added to the buffer
retrain_buffer_counter
Counter for the number of new points added since last retraining
add_buffer_in_prediction
If TRUE, points in the data buffers are added to the GP before prediction. They are added into a temporarily created GP which contains the not yet included points. The GP in the node is not yet updated.
X_shared
Matrix with x points that this GP shares with the GP in the sibling node
y_shared
Vector of y points that this GP shares with the GP in the sibling node
y_var_shared
Vector of y_var points that this GP shares with the GP in the sibling node
n_shared_points
The number of own points shared with the GP in the sibling node
Methods
Public methods
Method new()
Create a new WrappedmlegpGP object
Usage
WrappedmlegpGP$new( X, y, y_var, gp_control, init_covpars, retrain_buffer_length, add_buffer_in_prediction, estimate_covpars = TRUE, X_shared = NULL, y_shared = NULL, y_var_shared = NULL )
Arguments
X
Input data matrix with x_dim columns and at maximum Nbar rows. Is used to create the first iteration of the local GP.
y
Value of target variable at input point x; has to be a one-dimensional matrix or a vector; any further columns will be ignored
y_var
Variance of the target variable; has to be a one-dimensional matrix or vector
gp_control
A list of GP implementation-specific options, passed directly to the wrapped GP implementation
init_covpars
Initial covariance parameters of the local GP
retrain_buffer_length
Only retrain when the number of buffer points or collected points exceeds this value
add_buffer_in_prediction
If TRUE, points in the data buffers are added to the GP before prediction. They are added into a temporarily created GP which contains the not yet included points. The GP in the node is not yet updated.
estimate_covpars
If TRUE, the parameters are estimated by the package. Otherwise, the parameters from init_covpars are taken
X_shared
Matrix with x points that this GP shares with the GP in the sibling node
y_shared
Vector of y points that this GP shares with the GP in the sibling node
y_var_shared
Vector of y_var points that this GP shares with the GP in the sibling node
Returns
A new WrappedmlegpGP object. Besides the local GP, information on the shared points and those stored in the buffer are collected. For more information on the GP, consult the method mlegp::mlegp in the mlegp
package.
Method update_init_covpars()
Stores the initial covariance parameters (length-scales, standard deviation and trend coefficients) of the GP in the field init_covpars
Usage
WrappedmlegpGP$update_init_covpars()
Method get_lengthscales()
Retrieves the length-scales of the kernel of the local GP
Usage
WrappedmlegpGP$get_lengthscales()
Method get_X_data()
Retrieves the design matrix X
Usage
WrappedmlegpGP$get_X_data(include_shared = FALSE)
Arguments
include_shared
If TRUE, shared points between this GP and its sibling GP are included
Method get_y_data()
Retrieves the response
Usage
WrappedmlegpGP$get_y_data(include_shared = FALSE)
Arguments
include_shared
If TRUE, shared points between this GP and its sibling GP are included
Method get_y_var_data()
Retrieves the individual variances from the response
Usage
WrappedmlegpGP$get_y_var_data(include_shared = FALSE)
Arguments
include_shared
If TRUE, shared points between this GP and its sibling GP are included
Method get_cov_mat()
Retrieves the covariance matrix
Usage
WrappedmlegpGP$get_cov_mat()
Returns
the covariance matrix
Method update_add_y_var()
Method for updating add_y_var based on a bound for the covariance matrix condition number, based on this paper, Section 5.4
Usage
WrappedmlegpGP$update_add_y_var(max_cond_num)
Arguments
max_cond_num
Max allowed condition number
Method store_point()
Stores a new point into the respective buffer method
Usage
WrappedmlegpGP$store_point(x, y, y_var, shared = FALSE, remove_shared = TRUE)
Arguments
x
Single input data point from the data stream; has to be a vector or row matrix with length equal to x_dim
y
Value of target variable at input point x; has to be a one-dimensional matrix or a vector; any further columns will be ignored
y_var
Variance of the target variable; has to be a one-dimensional matrix or vector
shared
If TRUE, this point is shared between this GP and its sibling GP
remove_shared
If TRUE, the last of the shared points is removed
Method delete_buffers()
Method for clearing the buffers
Usage
WrappedmlegpGP$delete_buffers()
Method train()
Method for (re)creating / (re)training the GP
Usage
WrappedmlegpGP$train(do_buffer_check = TRUE)
Arguments
do_buffer_check
If TRUE, only train the GP if the number of stored points is larger than retrain_buffer_length
Returns
TRUE if training was performed, otherwise FALSE
Method predict()
Method for prediction
Usage
WrappedmlegpGP$predict(x, return_std = TRUE)
Arguments
x
Single data point for which the predicted mean (and standard deviation) is computed; has to be a vector or row matrix with length equal to x_dim
return_std
If TRUE, the standard error is returned in addition to the prediction
Returns
Prediction for input point x
Method delete_gp()
Method to delete the GP object in self$gp
Usage
WrappedmlegpGP$delete_gp()
Method create_mlegp_gp()
Method for calling the 'mlegp' function in mlegp to create a GP object, stored in self$gp
Usage
WrappedmlegpGP$create_mlegp_gp(X, y, y_var)
Arguments
X
Input data matrix with x_dim columns and at maximum Nbar rows for the local GP.
y
Value of target variable at input point x; has to be a one-dimensional matrix or a vector; any further columns will be ignored
y_var
Variance of the target variable; has to be a one-dimensional matrix or vector
Returns
TRUE
Method call_mlegp_predict()
Method for calling the 'predict' function in mlegp
Usage
WrappedmlegpGP$call_mlegp_predict(x, use_gp = NULL)
Arguments
x
Single data point for which the predicted mean (and standard deviation) is computed; has to be a vector with length equal to x_dim
use_gp
Optional user-defined GP which is evaluated instead of the local GP
Returns
The predictions for x from the specified GP, by default the local GP. The output needs to be a list with fields mean and sd for the prediction and prediction error, respectively.
Method clone()
The objects of this class are cloneable with this method.
Usage
WrappedmlegpGP$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.