DKLGP#

class obsidian.surrogates.custom_GP.DKLGP(train_X, train_Y)[source]#

Bases: ExactGP, GPyTorchModel

GP surrogate with a FF NN feature extractor

__init__(train_X, train_Y)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Methods

__init__(train_X, train_Y)

Initialize internal Module state, shared by both nn.Module and ScriptModule.

add_module(name, module)

Add a child module to the current module.

added_loss_terms()

apply(fn)

Apply fn recursively to every submodule (as returned by .children()) as well as self.

bfloat16()

Casts all floating point parameters and buffers to bfloat16 datatype.

buffers([recurse])

Return an iterator over module buffers.

children()

Return an iterator over immediate children modules.

compile(*args, **kwargs)

Compile this Module's forward using torch.compile().

condition_on_observations(X, Y[, noise])

Condition the model on new observations.

constraint_for_parameter_name(param_name)

constraints()

construct_inputs(training_data)

Construct Model keyword arguments from a SupervisedDataset.

cpu()

Move all model parameters and buffers to the CPU.

cuda([device])

Move all model parameters and buffers to the GPU.

double()

Casts all floating point parameters and buffers to double datatype.

eval()

Puts the model in eval mode and sets the transformed inputs.

extra_repr()

Set the extra representation of the module.

float()

Casts all floating point parameters and buffers to float datatype.

forward(x)

Evaluate the forward pass of the model on inputs X

get_buffer(target)

Return the buffer given by target if it exists, otherwise throw an error.

get_extra_state()

Return any extra state to include in the module's state_dict.

get_fantasy_model(inputs, targets, **kwargs)

Returns a new GP model that incorporates the specified inputs and targets as new training data.

get_parameter(target)

Return the parameter given by target if it exists, otherwise throw an error.

get_submodule(target)

Return the submodule given by target if it exists, otherwise throw an error.

half()

Casts all floating point parameters and buffers to half datatype.

hyperparameters()

initialize(**kwargs)

Set a value for a parameter

ipu([device])

Move all model parameters and buffers to the IPU.

load_state_dict(state_dict[, strict, assign])

Copy parameters and buffers from state_dict into this module and its descendants.

load_strict_shapes(value)

local_load_samples(samples_dict, memo, prefix)

Replace the model's learned hyperparameters with samples from a posterior distribution.

modules()

Return an iterator over all modules in the network.

named_added_loss_terms()

Returns an iterator over module variational strategies, yielding both the name of the variational strategy as well as the strategy itself.

named_buffers([prefix, recurse, ...])

Return an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.

named_children()

Return an iterator over immediate children modules, yielding both the name of the module as well as the module itself.

named_constraints([memo, prefix])

named_hyperparameters()

named_modules([memo, prefix, remove_duplicate])

Return an iterator over all modules in the network, yielding both the name of the module as well as the module itself.

named_parameters([prefix, recurse, ...])

Return an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.

named_parameters_and_constraints()

named_priors([memo, prefix])

Returns an iterator over the module's priors, yielding the name of the prior, the prior, the associated parameter names, and the transformation callable.

named_variational_parameters()

parameters([recurse])

Return an iterator over module parameters.

posterior(X[, observation_noise, ...])

Computes the posterior over model outputs at the provided points.

pyro_load_from_samples(samples_dict)

Convert this Module in to a batch Module by loading parameters from the given samples_dict.

pyro_sample_from_prior()

For each parameter in this Module and submodule that have defined priors, sample a value for that parameter from its corresponding prior with a pyro.sample primitive and load the resulting value in to the parameter.

register_added_loss_term(name)

register_backward_hook(hook)

Register a backward hook on the module.

register_buffer(name, tensor[, persistent])

Add a buffer to the module.

register_constraint(param_name, constraint)

register_forward_hook(hook, *[, prepend, ...])

Register a forward hook on the module.

register_forward_pre_hook(hook, *[, ...])

Register a forward pre-hook on the module.

register_full_backward_hook(hook[, prepend])

Register a backward hook on the module.

register_full_backward_pre_hook(hook[, prepend])

Register a backward pre-hook on the module.

register_load_state_dict_post_hook(hook)

Register a post hook to be run after module's load_state_dict is called.

register_module(name, module)

Alias for add_module().

register_parameter(name, parameter)

Adds a parameter to the module.

register_prior(name, prior, param_or_closure)

Adds a prior to the module.

register_state_dict_pre_hook(hook)

Register a pre-hook for the state_dict() method.

requires_grad_([requires_grad])

Change if autograd should record operations on parameters in this module.

sample_from_prior(prior_name)

Sample parameter values from prior.

set_extra_state(state)

Set extra state contained in the loaded state_dict.

set_train_data([inputs, targets, strict])

Set training data (does not re-fit model hyper-parameters).

share_memory()

See torch.Tensor.share_memory_().

state_dict(*args[, destination, prefix, ...])

Return a dictionary containing references to the whole state of the module.

subset_output(idcs)

Subset the model along the output dimension.

to(*args, **kwargs)

Move and/or cast the parameters and buffers.

to_empty(*, device[, recurse])

Move the parameters and buffers to the specified device without copying storage.

to_pyro_random_module()

to_random_module()

train([mode])

Put the model in train mode.

transform_inputs(X[, input_transform])

Transform inputs.

type(dst_type)

Casts all parameters and buffers to dst_type.

update_added_loss_term(name, added_loss_term)

variational_parameters()

xpu([device])

Move all model parameters and buffers to the XPU.

zero_grad([set_to_none])

Reset gradients of all model parameters.

Attributes

T_destination

batch_shape

The batch shape of the model.

call_super_init

dtypes_of_buffers

dump_patches

num_outputs

The number of outputs of the model.

train_targets

likelihood

training

forward(x)[source]#

Evaluate the forward pass of the model on inputs X