axtreme.utils.model_helpers

Utility functions for working with botorch models.

Functions

get_target_noise_singletaskgp(model)

A helper to extract the training varaince from a botorch model, and return it in a consistent format.

get_training_data_singletaskgp(model)

Extracts the training data from SIngleTaskGP in consistent form.

axtreme.utils.model_helpers.get_target_noise_singletaskgp(model: SingleTaskGP) Tensor

A helper to extract the training varaince from a botorch model, and return it in a consistent format.

Parameters:

model – A SingleTaskGP model.

Returns:

A torch.Tensor of the noise with shape (*b, n,m) where b is an optional batch dimention, n is the number of observations, m is the number of targets. If homoskedatic noise is used shape will be (*b, n=1,m).

Return type:

noise (variance)

NOTE: Approach is based on FantasizeMixin.fantasize. NOTE: Currently unclear if this interface extends to othe type of model.

axtreme.utils.model_helpers.get_training_data_singletaskgp(model: SingleTaskGP) Tensor

Extracts the training data from SIngleTaskGP in consistent form.

As per Botorch documentation, “SingleTaskGP Modules same training data for all outputs” (BoTorch docs) As such we are not concerned with batch dimenstion. Gpytorch stores training data in this format:

  • if m = 1: (*b,n,d)

  • if m > 1: (*b,m,n,d)

Parameters:

model – the model to collect the training data from.

Returns:

(n,d) A torch.Tensor of the training_inputs

Return type:

training_inputs

NOTE: The interface defined here is only available for SingleTaskGPs, as other model can contain different input

data for each batch.