gpflux.layers.basis_functions.fourier_features.random#
A kernel’s features and coefficients using Random Fourier Features (RFF).
Package Contents#
- class RandomFourierFeatures(kernel: gpflow.kernels.Kernel, n_components: int, **kwargs: Mapping)[source]#
Bases:
RandomFourierFeaturesBase
Random Fourier features (RFF) is a method for approximating kernels. The essential element of the RFF approach [RR07] is the realization that Bochner’s theorem for stationary kernels can be approximated by a Monte Carlo sum.
We will approximate the kernel
by where is a finite-dimensional feature map.The feature map is defined as:
where
is the kernel variance. The features are parameterised by random weights: where is the spectral density of the kernel.
At least for the squared exponential kernel, this variant of the feature mapping has more desirable theoretical properties than its counterpart form from phase-shifted cosines
RandomFourierFeaturesCosine
[SS15].- Parameters:
kernel – kernel to approximate using a set of Fourier bases.
n_components – number of components (e.g. Monte Carlo samples, quadrature nodes, etc.) used to numerically approximate the kernel.
- class RandomFourierFeaturesCosine(kernel: gpflow.kernels.Kernel, n_components: int, **kwargs: Mapping)[source]#
Bases:
RandomFourierFeaturesBase
Random Fourier Features (RFF) is a method for approximating kernels. The essential element of the RFF approach [RR07] is the realization that Bochner’s theorem for stationary kernels can be approximated by a Monte Carlo sum.
We will approximate the kernel
by where is a finite-dimensional feature map.The feature map is defined as:
where
is the kernel variance. The features are parameterised by random weights: where is the spectral density of the kernel
Equivalent to
RandomFourierFeatures
by elementary trigonometric identities.- Parameters:
kernel – kernel to approximate using a set of Fourier bases.
n_components – number of components (e.g. Monte Carlo samples, quadrature nodes, etc.) used to numerically approximate the kernel.
- build(input_shape: gpflux.types.ShapeType) None [source]#
Creates the variables of the layer. See tf.keras.layers.Layer.build().
- class OrthogonalRandomFeatures(kernel: gpflow.kernels.Kernel, n_components: int, **kwargs: Mapping)[source]#
Bases:
gpflux.layers.basis_functions.fourier_features.random.base.RandomFourierFeatures
Orthogonal random Fourier features (ORF) [YSC+16] for more efficient and accurate kernel approximations than
RandomFourierFeatures
.- Parameters:
kernel – kernel to approximate using a set of Fourier bases.
n_components – number of components (e.g. Monte Carlo samples, quadrature nodes, etc.) used to numerically approximate the kernel.