yamle.models.gp module#

class yamle.models.gp.GPModel(prior_mean, prior_covariance, inducing_points, num_latent, num_outputs, task)[source]#

Bases: ApproximateGP

This class is used to create a Gaussian Process model with the given parameters.

Parameters:
  • prior_mean (str) – The prior mean function. Can be ‘zero’ or ‘constant’.

  • prior_covariance (str) – The prior covariance function. Can be ‘rbf’, ‘matern32’, ‘matern52’.

  • inducing_points (torch.Tensor) – The inducing points.

  • num_latent (int) – The latent dimension.

  • num_outputs (int) – The number of outputs.

  • task (str) – The task to perform. Either ‘classification’ or ‘regression’. The task determined is softmax is used for the output layer.

forward(x, staged_output=False, input_kwargs={}, output_kwargs={})[source]#

This function is used to perform the forward pass of the model.

Parameters:
  • x (torch.Tensor) – The input tensor.

  • staged_output (bool) – Whether to return the intermediate outputs. Not used in this model.

  • input_kwargs (Dict[str, Any]) – The kwargs for the input layer.

  • output_kwargs (Dict[str, Any]) – The kwargs for the output layer.

Return type:

Union[Tensor, Tuple[Tensor, List[Tensor]]]

final_layer(x)[source]#

This function is used to get the final layer output.

Return type:

Tensor

add_method_specific_layers(method)[source]#

This method is used to add method specific layers to the model.

Parameters:

method (str) – The method to use.

Return type:

None

training: bool#
static add_specific_args(parent_parser)[source]#

This method is used to add the model specific arguments to the parent parser.

Return type:

ArgumentParser

reset()[source]#

This function is used to reset the model after each epoch.

Return type:

None