noise

class MuyGPyS.gp.noise.homoscedastic.HomoscedasticNoise(val, bounds='fixed', _backend_fn=<function _homoscedastic_perturb>)[source]

A scalar prior noise parameter.

A homoscedastic noise parameter used to build the “nugget” with the prior assumption that all observations are subject to i.i.d. unbiased Gaussian noise. Can be set at initialization time or left subject to optimization, in which case (positive) bounds are specified.

Parameters:
  • val (Union[str, float]) – A positive scalar, or the strings "sample" or "log_sample".

  • bounds (Union[str, Tuple[float, float]]) – Iterable container of len 2 containing positive lower and upper bounds (in that order), or the string "fixed".

Raises:

ValueError – Any nonpositive bounds string will produce an error.

perturb(K, noise=None, **kwargs)[source]

Perturb a kernel tensor with homoscedastic noise.

Applies a homoscedastic noise model to a kernel tensor, whose last two dimensions are assumed to be the same length. For each such square submatrix \(K\), computes the form \(K + \tau^2 * I\), where \(\tau^2\) is the shared noise prior variance and \(I\) is the conforming identity matrix.

Parameters:
  • K (ndarray) – A tensor of shape (batch_count, nn_count, nn_count) containing the (nn_count, nn_count)-shaped kernel matrices corresponding to each of the batch elements.

  • noise (Optional[float]) – A floating-point value for the noise variance prior, or None. None prompts the use of the stored value, whereas supplying alternative values is employed during optimization.

Return type:

ndarray

Returns:

A tensor of shape (batch_count, nn_count, nn_count) where the final two dimensions consist of the perturbed matrices of the input \(K\).

perturb_fn(fn)[source]

Perturb a function of kernel tensors with homoscedastic noise.

Applies a homoscedastic noise model to the first argument of the given function, which is assumed to be a kernel tensor whose last two dimensions are the same length. The returned function is the same as the input, save that it perturbs any passed kernel tensors.

Parameters:

fn (Callable) – A callable whose first argument is assumed to be a tensor of shape (batch_count, nn_count, nn_count) containing the (nn_count, nn_count)-shaped kernel matrices corresponding to each of the batch elements.

Return type:

Callable

Returns:

A Callable with the same signature that applies a homoscedastic perturbation to its first argument. Also adds a noise keyword argument that is only used for optimization.

class MuyGPyS.gp.noise.null.NullNoise(*args, **kwargs)[source]

A zero noise assumption model.

perturb(K, **kwargs)[source]

Null noise perturbation.

Simply returns the input tensor unchanged.

Parameters:

K (ndarray) – A tensor of shape (batch_count, nn_count, nn_count) containing the (nn_count, nn_count)-shaped kernel matrices corresponding to each of the batch elements.

Return type:

ndarray

Returns:

The same tensor.

class MuyGPyS.gp.noise.heteroscedastic.HeteroscedasticNoise(val, _backend_fn=<function _heteroscedastic_perturb>)[source]

A tensor noise parameter.

A heteroscedastic noise tensor used to build the “nugget” with the prior assumption that all observations are have a corresponding measurement noise prior variance.

Parameters:

val (ndarray) – An ndarray of shape (batch_count, nn_count) containing the heteroscedastic nugget matrix.

Raises:

ValueError – Any strictly negative entry in the array will produce an error.

fixed()[source]

Overloading fixed function to return True for heteroscedastic noise.

Return type:

bool

Returns:

True - we do not allow optimizing Heteroscedastic Noise.

perturb(K, **kwargs)[source]

Perturb a kernel tensor with heteroscedastic noise.

Applies a heteroscedastic noise model to a kernel tensor, whose last two dimensions are assumed to be the same length. For each such square submatrix \(K\), computes the form \(K + D\), where \(D\) is the diagonal matrix containing the observation-wise noise priors.

Parameters:

K (ndarray) – A tensor of shape (batch_count, nn_count, nn_count) containing the (nn_count, nn_count)-shaped kernel matrices corresponding to each of the batch elements.

Return type:

ndarray

Returns:

A tensor of shape (batch_count, nn_count, nn_count) where the final two dimensions consist of the perturbed matrices of the input \(K\).

perturb_fn(fn)[source]

Perturb a function of kernel tensors with heteroscedastic noise.

Applies a heteroscedastic noise model to the first argument of the given function, which is assumed to be a kernel tensor whose last two dimensions are the same length. The returned function is the same as the input, save that it perturbs any passed kernel tensors.

Parameters:

fn (Callable) – A callable whose first argument is assumed to be a tensor of shape (batch_count, nn_count, nn_count) containing the (nn_count, nn_count)-shaped kernel matrices corresponding to each of the batch elements.

Return type:

Callable

Returns:

A Callable with the same signature that applies a homoscedastic perturbation to its first argument.