aepsych.kernels¶
Submodules¶
aepsych.kernels.rbf_partial_grad module¶
- class aepsych.kernels.rbf_partial_grad.RBFKernelPartialObsGrad(ard_num_dims=None, batch_shape=None, active_dims=None, lengthscale_prior=None, lengthscale_constraint=None, eps=1e-06, **kwargs)[source]¶
Bases:
RBFKernelGrad
An RBF kernel over observations of f, and partial/non-overlapping observations of the gradient of f.
gpytorch.kernels.rbf_kernel_grad assumes a block structure where every partial derivative is observed at the same set of points at which x is observed. This generalizes that by allowing f and any subset of the derivatives of f to be observed at different sets of points.
The final column of x1 and x2 needs to be an index that identifies what is observed at that point. It should be 0 if this observation is of f, and i if it is of df/dxi.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- Parameters:
ard_num_dims (Optional[int]) –
batch_shape (Optional[torch.Size]) –
active_dims (Optional[Tuple[int, ...]]) –
lengthscale_prior (Optional[Prior]) –
lengthscale_constraint (Optional[Interval]) –
eps (float) –
- forward(x1, x2, diag=False, **params)[source]¶
Computes the covariance between \(\mathbf x_1\) and \(\mathbf x_2\). This method should be imlemented by all Kernel subclasses.
- Parameters:
x1 (Tensor) – First set of data (… x N x D).
x2 (Tensor) – Second set of data (… x M x D).
diag (bool) – Should the Kernel compute the whole kernel, or just the diag? If True, it must be the case that x1 == x2. (Default: False.)
last_dim_is_batch – If True, treat the last dimension of x1 and x2 as another batch dimension. (Useful for additive structure over the dimensions). (Default: False.)
params (Any) –
- Returns:
The kernel matrix or vector. The shape depends on the kernel’s evaluation mode:
full_covar: … x N x M
full_covar with last_dim_is_batch=True: … x K x N x M
diag: … x N
diag with last_dim_is_batch=True: … x K x N
- Return type:
Tensor
- num_outputs_per_input(x1, x2)[source]¶
For most kernels, num_outputs_per_input = 1.
However, some kernels (e.g. multitask kernels or interdomain kernels) return a num_outputs_per_input x num_outputs_per_input matrix of covariance values for every pair of data points.
I.e. if x1 is size … x N x D and x2 is size … x M x D, then the size of the kernel will be … x (N * num_outputs_per_input) x (M * num_outputs_per_input).
- Returns:
num_outputs_per_input (usually 1).
- Parameters:
x1 (Tensor) –
x2 (Tensor) –
- Return type:
int