mxfusion.components.distributions.gp.kernels.kernel¶
Members¶
-
class
mxfusion.components.distributions.gp.kernels.kernel.
Kernel
(input_dim, name, active_dims=None, dtype=None, ctx=None)¶ Bases:
mxfusion.components.functions.mxfusion_function.MXFusionFunction
The base class for a Gaussian process kernel: a positive definite function which forms of a covariance function (kernel).
Parameters: (default: None, taking all the dimensions). :type active_dims: [int] or None :param dtype: the data type for float point numbers. :type dtype: numpy.float32 or numpy.float64 :param ctx: the mxnet context (default: None/current context). :type ctx: None or mxnet.cpu or mxnet.gpu
-
broadcastable
= False¶
-
local_parameters
¶ The kernel parameters in the current kernel, which does not include kernel parameters that belongs to the sub-kernels of a compositional kernel. The keys of the returned dictionary are the name of the kernel parameters (without the prefix) and the values are the corresponding variables.
Returns: a dictionary of local kernel parameters, in which the keys are the name of individual parameters, including the kernel in front, and the values are the corresponding Variables. :rtype: {str: Variable}
-
parameters
¶ All the kernel parameters including the kernel parameters that belongs to the sub-kernels. The keys of the returned dictionary are the name of the kernel parameters with a prefix (the name of the kernel plus ‘_’) and the values are the corresponding variables.
Returns: a dictionary of all the kernel parameters, in which the keys are the name of individual parameters, including the kernel in front, and the values are the corresponding Variables. :rtype: {str: Variable}
-
input_names
¶ The names of all the inputs that the function takes including the function parameters
-
output_names
¶ The names of all the outputs of the function
-
K
(F, X, X2=None, **kernel_params)¶ Compute the covariance matrix.
\[K_{ij} = k(X_i, X2_j)\]Parameters: - F – MXNet computation type <mx.sym, mx.nd>.
- X (MXNet NDArray or MXNet Symbol) – the first set of inputs to the kernel.
- X2 – (optional) the second set of arguments to the kernel. If X2 is None, this computes a square
covariance matrix of X. In other words, X2 is internally treated as X. :type X2: MXNet NDArray or MXNet Symbol :param kernel_params: the set of kernel parameters, provided as keyword arguments. :type kernel_params: {str: MXNet NDArray or MXNet Symbol} :return: The covariance matrix :rtype: MXNet NDArray or MXNet Symbol
-
Kdiag
(F, X, **kernel_params)¶ Compute the diagonal of the covariance matrix.
\[K_{ii} = k(X_i, X_i)\]Parameters: - F – MXNet computation type <mx.sym, mx.nd>.
- X (MXNet NDArray or MXNet Symbol) – the first set of inputs to the kernel.
- kernel_params ({str: MXNet NDArray or MXNet Symbol}) – the set of kernel parameters, provided as keyword arguments.
Returns: The diagonal of the covariance matrix.
Return type: MXNet NDArray or MXNet Symbol
-
add
(other, name='add')¶ Construct a new kernel by adding this kernel to another kernel.
Parameters: Returns: the kernel which is the sum of the current kernel with the specified kernel.
Return type:
-
multiply
(other, name='mul')¶ Construct a new kernel by multiplying this kernel with another kernel.
Parameters: Returns: the kernel which is the sum of the current kernel with the specified kernel.
Return type:
-
fetch_parameters
(params)¶ The helper function to fetch the kernel parameters from a set of variables according to the UUIDs of the kernel parameters. It returns a dictionary of kernel parameters, where the keys are the name of the kernel parameters and the values are the MXNet array at runtime. The returned dict can be directly passed into K and Kdiag as kernel_params.
Parameters: params ({str (UUID): MXNet NDArray or MXNet Symbol}) – the set of parameters where the kernel parameters are fetched from. Returns: a dict of the kernel parameters, where the keys are the name of the kernel parameters and the values are the MXNet array at runtime. :rtype: {str (kernel name): MXNet NDArray or MXNet Symbol}
-
eval
(F, X, X2=None, **kernel_params)¶ The method handling the execution of the function.
Parameters: - F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray)
- input_kws – the dict of inputs to the functions. The key in the
dict should match with the name of inputs specified in the inputs of FunctionEvaluation. :type input_kws: {variable name: MXNet NDArray or MXNet Symbol} :returns: the return value of the function :rtypes: MXNet NDArray or MXNet Symbol
-
replicate_self
(attribute_map=None)¶ The copy constructor for a kernel.
-
-
class
mxfusion.components.distributions.gp.kernels.kernel.
NativeKernel
(input_dim, name, active_dims=None, dtype=None, ctx=None)¶ Bases:
mxfusion.components.distributions.gp.kernels.kernel.Kernel
The base class for all the native kernels: the computation of the covariance matrix does not depend on other kernels.
Parameters: (default: None, taking all the dimensions). :type active_dims: [int] or None :param dtype: the data type for float point numbers. :type dtype: numpy.float32 or numpy.float64 :param ctx: the mxnet context (default: None/current context). :type ctx: None or mxnet.cpu or mxnet.gpu
-
parameters
¶ All the kernel parameters including the kernel parameters that belongs to the sub-kernels. The keys of the returned dictionary are the name of the kernel parameters with a prefix (the name of the kernel plus ‘_’) and the values are the corresponding variables.
Returns: a dictionary of all the kernel parameters, in which the keys are the name of individual parameters, including the kernel in front, and the values are the corresponding Variables. :rtype: {str: Variable}
-
parameter_names
¶ The names of all the function parameters.
-
-
class
mxfusion.components.distributions.gp.kernels.kernel.
CombinationKernel
(sub_kernels, name, dtype=None, ctx=None)¶ Bases:
mxfusion.components.distributions.gp.kernels.kernel.Kernel
The base class for combination kernels: the covariance matrix is computed by combining the covariance matrix from multiple sub-kernels.
Parameters: - sub_kernels ([Kernel]) – a list of kernels that are combined to compute a covariance matrix.
- name (str) – the name of the kernel. The name is used to access kernel parameters.
- dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
- ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
-
parameters
¶ All the kernel parameters including the kernel parameters that belongs to the sub-kernels. The keys of the returned dictionary are the name of the kernel parameters with a prefix (the name of the kernel plus ‘_’) and the values are the corresponding variables.
Returns: a dictionary of all the kernel parameters, in which the keys are the name of individual parameters, including the kernel in front, and the values are the corresponding Variables. :rtype: {str: Variable}
-
parameter_names
¶ The names of all the function parameters.
-
replicate_self
(attribute_map=None)¶ The copy constructor for a kernel.