Neural Kernel
sgptools.kernels.neural_kernel
Provides a neural spectral kernel function along with an initialization function
NeuralSpectralKernel
Bases: Kernel
Neural Spectral Kernel function (non-stationary kernel function). Based on the implementation from the following repo
Refer to the following papers for more details
- Neural Non-Stationary Spectral Kernel [Remes et al., 2018]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_dim |
int
|
Number of data dimensions |
required |
active_dims |
int
|
Number of data dimensions that are used for computing the covariances |
None
|
Q |
int
|
Number of MLP mixture components used in the kernel function |
1
|
hidden_sizes |
list
|
Number of hidden units in each MLP layer. Length of the list determines the number of layers. |
[32, 32]
|
Source code in sgptools/kernels/neural_kernel.py
K(X, X2=None)
Computes the covariances between/amongst the input variables
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
ndarray
|
Variables to compute the covariance matrix |
required |
X2 |
ndarray
|
If passed, the covariance between X and X2 is computed. Otherwise, the covariance between X and X is computed. |
None
|
Returns:
Name | Type | Description |
---|---|---|
cov |
ndarray
|
covariance matrix |
Source code in sgptools/kernels/neural_kernel.py
init_neural_kernel(x, y, inducing_variable, Q, n_inits=1, hidden_sizes=None)
Helper function to initialize a Neural Spectral Kernel function (non-stationary kernel function). Based on the implementation from the following repo
Refer to the following papers for more details
- Neural Non-Stationary Spectral Kernel [Remes et al., 2018]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
(n, d); Input training set points |
required |
y |
ndarray
|
(n, 1); Training set labels |
required |
inducing_variable |
ndarray
|
(m, d); Initial inducing points |
required |
Q |
int
|
Number of MLP mixture components used in the kernel function |
required |
n_inits |
int
|
Number of times to initalize the kernel function (returns the best model) |
1
|
hidden_sizes |
list
|
Number of hidden units in each MLP layer. Length of the list determines the number of layers. |
None
|