gpflux.layers.basis_functions.fourier_features.base#

Shared functionality for stationary kernel basis functions.

Module Contents#

class FourierFeaturesBase(kernel: gpflow.kernels.Kernel, n_components: int, **kwargs: Mapping)[source]#

Bases: abc.ABC, tf.keras.layers.Layer

The base class for all Fourier feature layers, used for both random Fourier feature layers and quadrature layers. We subclass tf.keras.layers.Layer, so we must provide :method:`build` and :method:`call` methods.

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.

call(inputs: gpflow.base.TensorType) tf.Tensor[source]#

Evaluate the basis functions at inputs.

Parameters:

inputs – The evaluation points, a tensor with the shape [N, D].

Returns:

A tensor with the shape [N, M], or shape ``[P, N, M]’’ in the multioutput case.

compute_output_shape(input_shape: gpflux.types.ShapeType) tf.TensorShape[source]#

Computes the output shape of the layer. See tf.keras.layers.Layer.compute_output_shape().

get_config() Mapping[source]#

Returns the config of the layer. See tf.keras.layers.Layer.get_config().

abstract _compute_constant() tf.Tensor[source]#

Compute normalizing constant for basis functions.

abstract _compute_bases(inputs: gpflow.base.TensorType) tf.Tensor[source]#

Compute basis functions.