revrand.basis_functions.FastFoodGM¶
-
class
revrand.basis_functions.
FastFoodGM
(nbases, Xdim, mean=Parameter(value=0.0, bounds=Bound(lower=None, upper=None), shape=()), lenscale=Parameter(value=1.0, bounds=Positive(upper=None), shape=()), regularizer=None, random_state=None)¶ A mixture component from a Gaussian spectral mixture kernel approximation.
This implements a GM basis component from “A la Carte - Learning Fast Kernels”. This essentially learns the form of a kernel function, and so has no explicit kernel representation!
To fully implement a Gaussian spectral mixture, concatenate as many of these objects as desired (one per mixture component). Also remember to initialize all of the bases with different means.
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).
- mean (Parameter, optional) – A scalar or vector of shape (1,) or (d,) Parameter to bound and initialise the component frequency means for optimization. This will always initialise (d,) means if a scalr bound is given, it is applied to all means.
- lenscale (Parameter, optional) – A scalar or vector of shape (1,) or (d,) Parameter to bound and initialise the length scales for optimization. This will always initialise ARD length scales, if a scalr bound is given, it is applied to all length scales.
- 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, mean=Parameter(value=0.0, bounds=Bound(lower=None, upper=None), shape=()), lenscale=Parameter(value=1.0, bounds=Positive(upper=None), shape=()), regularizer=None, random_state=None)¶ See this class’s docstring.
Methods
__init__
(nbases, Xdim[, mean, bounds, ...])See this class’s docstring. get_dim
(X)Get the output dimensionality of this basis. grad
(X[, mean, lenscale])Get the gradients of this basis w.r.t.the mean and length scales. 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[, mean, lenscale])Apply the spectral mixture component basis to X. Attributes
params
Get this basis’ Parameter types. regularizer
Get the Parameter
value of this basis’ regularizer.