Skip to content

Vectorial kernels

neps.optimizers.bayesian_optimization.kernels.vectorial_kernels #

LayeredRBFKernel #

LayeredRBFKernel(
    lengthscale: Union[float, Tuple[float, ...]] = 1.0,
    lengthscale_bounds: Tuple[float, float] = (
        np.exp(-6.754111155189306),
        np.exp(0.0858637988771976),
    ),
    outputscale=1.0,
    **kwargs
)

Bases: RBFKernel

Same as the conventional RBF kernel, but adapted in a way as a midway between spherical RBF and ARD RBF. In this case, one weight is assigned to each Weisfiler-Lehman iteration only (e.g. one weight for h=0, another for h=1 and etc.)

Source code in neps/optimizers/bayesian_optimization/kernels/vectorial_kernels.py
def __init__(
    self,
    lengthscale: Union[float, Tuple[float, ...]] = 1.0,
    lengthscale_bounds: Tuple[float, float] = (
        np.exp(-6.754111155189306),
        np.exp(0.0858637988771976),
    ),
    outputscale=1.0,
    **kwargs,
):
    super().__init__(**kwargs)
    self.lengthscale = lengthscale
    self.lengthscale_bounds = lengthscale_bounds
    self.outputscale = outputscale

    self._gram = None
    self._train = None

Stationary #

Stationary(
    lengthscale: Union[float, Tuple[float, ...]] = 1.0,
    lengthscale_bounds: Tuple[float, float] = (
        np.exp(-6.754111155189306),
        np.exp(0.0858637988771976),
    ),
    outputscale=1.0,
    **kwargs
)

Here we follow the structure of GPy to build a sub class of stationary kernel. All the classes (i.e. the class of stationary kernel_operators) derived from this class use the scaled distance to compute the Gram matrix.

Source code in neps/optimizers/bayesian_optimization/kernels/vectorial_kernels.py
def __init__(
    self,
    lengthscale: Union[float, Tuple[float, ...]] = 1.0,
    lengthscale_bounds: Tuple[float, float] = (
        np.exp(-6.754111155189306),
        np.exp(0.0858637988771976),
    ),
    outputscale=1.0,
    **kwargs,
):
    super().__init__(**kwargs)
    self.lengthscale = lengthscale
    self.lengthscale_bounds = lengthscale_bounds
    self.outputscale = outputscale

    self._gram = None
    self._train = None