# revrand.basis_functions.FastFoodRBF¶

class revrand.basis_functions.FastFoodRBF(nbases, Xdim, lenscale=Parameter(value=1.0, bounds=Positive(upper=None), shape=()), regularizer=None, random_state=None)

Fast Food radial basis function.

This is an approximation of the random radial basis function for a large number of bases.

$\phi(\mathbf{x})^\top \phi(\mathbf{x}') \approx \exp\left( -\frac{\| \mathbf{x} - \mathbf{x}' \|^2}{2 l^2} \right)$

with a length scale, $$l$$ (a vector in $$\mathbb{R}^d$$ for ARD).

Parameters: nbases (int) – a scalar for how many (unique) random bases to create approximately, this actually will be to the nearest larger two power. Xdim (int) – the dimension (d) of the observations (or the dimension of the slices if using apply_ind). lenscale (Parameter, optional) – A scalar or vector of shape (1,) or (d,) Parameter to bound and initialise the length scales for optimization. If this is shape (d,), ARD length scales will be expected, otherwise an isotropic lenscale is learned. regularizer (None, Parameter, optional) – The (initial) value of the regularizer/prior variance to apply to the regression weights of this basis function. The Parameter object must have a scalar value. If it is not set, it will take on a default value of Parameter(gamma(1.), Positive()). random_state (None, int or RandomState, optional) – random seed
__init__(nbases, Xdim, lenscale=Parameter(value=1.0, bounds=Positive(upper=None), shape=()), regularizer=None, random_state=None)

See this class’s docstring.

Methods

 __init__(nbases, Xdim[, lenscale, bounds, ...]) See this class’s docstring. get_dim(X) Get the output dimensionality of this basis. grad(X[, lenscale]) Get the gradients of this basis w.r.t.the length scale. params_values() Get a list of the Parameter values if they have a value. regularizer_diagonal(X[, regularizer]) Get the diagonal of the prior variance on the weights (regularizer). transform(X[, lenscale]) Apply the Fast Food RBF basis to X.

Attributes

 params Get this basis’ Parameter types. regularizer Get the Parameter value of this basis’ regularizer.