distortion
MuyGPyS.gp.distortion module reference.
- class MuyGPyS.gp.distortion.IsotropicDistortion(metric, length_scale)[source]
An isotropic distance model.
IsotropicDistortion parameterizes a scaled elementwise distance function \(d(\cdot, \cdot)\), and is paramterized by a scalar \(\ell>0\) length scale hyperparameter.
\[d_\ell(\mathbf{x}, \mathbf{y}) = \sum_{i=0}^d \frac{d(\mathbf{x}_i, \mathbf{y}_i)}{\ell}\]- Parameters:
metric (
Callable
) – A callable metric function that takes a tensor of shape (…, feature_count) whose last dimension lists the elementwise differences between a pair of feature vectors and returns a tensor of shape (…), having collapsed the last dimension into a scalar difference.length_scale (
Union
[ScalarHyperparameter
,HierarchicalNonstationaryHyperparameter
]) – Some scalar nonnegative hyperparameter object.
- __call__(diffs, length_scale)[source]
Apply isotropic distortion to an elementwise difference tensor.
This function is not intended to be invoked directly by a user. It is instead functionally incorporated into some
MuyGPyS.gp.kernels.KernelFn
in its constructor.- Parameters:
diffs (
ndarray
) – A tensor of pairwise differences of shape (…, feature_count).length_scale (
Union
[float
,ndarray
]) – A floating point length scale, or a vector of (knot_count,) knot length scales.
- Return type:
ndarray
- Returns:
A crosswise distance matrix of shape (data_count, nn_count) or a pairwise distance tensor of shape (data_count, nn_count, nn_count) whose last two dimensions are pairwise distance matrices.
- get_opt_fn(fn)[source]
Return a kernel function with fixed parameters set.
This function is designed for use with
MuyGPyS.optimize.chassis.optimize_from_tensors()
and assumes that optimization parameters will be passed as keyword arguments.- Return type:
Callable
- Returns:
A function implementing the kernel where all fixed parameters are set. The function expects keyword arguments corresponding to current hyperparameter values for unfixed parameters.
- get_opt_params()[source]
Report lists of unfixed hyperparameter names, values, and bounds.
- Return type:
Tuple
[List
[str
],List
[float
],List
[Tuple
[float
,float
]]]- Returns:
- names:
A list of unfixed hyperparameter names.
- params:
A list of unfixed hyperparameter values.
- bounds:
A list of unfixed hyperparameter bound tuples.
- class MuyGPyS.gp.distortion.AnisotropicDistortion(metric, **length_scales)[source]
An isotropic distance model.
IsotropicDistortion parameterizes a scaled elementwise distance function \(d(\cdot, \cdot)\), and is paramterized by a vector-valued \(\mathbf{\ell}>0\) length scale hyperparameter.
\[d_\ell(\mathbf{x}, \mathbf{y}) = \sum_{i=0}^d \frac{d(\mathbf{x}_i, \mathbf{y}_i)}{\ell_i}\]- Parameters:
metric (
Callable
) – A callable metric function that takes a tensor of shape (…, feature_count) whose last dimension lists the elementwise differences between a pair of feature vectors and returns a tensor of shape (…), having collapsed the last dimension into a scalar difference.length_scales – Keyword arguments length_scale#, mapping to scalar hyperparameters.
- __call__(diffs, batch_features=None, **length_scales)[source]
Apply anisotropic distortion to an elementwise difference tensor.
This function is not intended to be invoked directly by a user. It is instead functionally incorporated into some
MuyGPyS.gp.kernels.KernelFn
in its constructor.- Parameters:
diffs (
ndarray
) – A tensor of pairwise differences of shape (…, feature_count).batch_features – A (batch_count, feature_count) matrix of features to be used with a hierarchical hyperparameter. None otherwise.
length_scale – A floating point length scale, or a vector of (knot_count,) knot length scales.
- Return type:
ndarray
- Returns:
A crosswise distance matrix of shape (data_count, nn_count) or a pairwise distance tensor of shape (data_count, nn_count, nn_count) whose last two dimensions are pairwise distance matrices.
- get_opt_fn(fn)[source]
Return a kernel function with fixed parameters set.
This function is designed for use with
MuyGPyS.optimize.chassis.optimize_from_tensors()
and assumes that optimization parameters will be passed as keyword arguments.- Return type:
Callable
- Returns:
A function implementing the kernel where all fixed parameters are set. The function expects keyword arguments corresponding to current hyperparameter values for unfixed parameters.
- get_opt_params()[source]
Report lists of unfixed hyperparameter names, values, and bounds.
- Return type:
Tuple
[List
[str
],List
[float
],List
[Tuple
[float
,float
]]]- Returns:
- names:
A list of unfixed hyperparameter names.
- params:
A list of unfixed hyperparameter values.
- bounds:
A list of unfixed hyperparameter bound tuples.