gluonts.mx.kernels package¶
-
class
gluonts.mx.kernels.
PeriodicKernel
(amplitude: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], length_scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], frequency: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], F=None)[source]¶ Bases:
gluonts.mx.kernels._kernel.Kernel
Computes a covariance matrix based on the Periodic kernel between inputs \(\mathbf{x_1}\) and \(\mathbf{x_2}\): \(k_{\text{Per}}(\mathbf{x_1}, \mathbf{x_2}) = \theta_0 \exp \left (\frac{-2\sin^2(\theta_2 \pi \|\mathbf{x_1} - \mathbf{x_2}\|)} {\theta_1^2} \right)\), where \(\theta_0\) is the amplitude parameter, \(\theta_1\) is the length scale parameter and \(\theta_2\) is the frequency parameter.
-
kernel_matrix
(x1: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], x2: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]¶ - Parameters
x1 (Tensor) – Feature data of shape (batch_size, history_length, num_features).
x2 (Tensor) – Feature data of shape (batch_size, history_length, num_features).
- Returns
Periodic kernel matrix of shape (batch_size, history_length, history_length).
- Return type
Tensor
-
-
class
gluonts.mx.kernels.
RBFKernel
(amplitude: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], length_scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], F=None)[source]¶ Bases:
gluonts.mx.kernels._kernel.Kernel
Computes a covariance matrix based on the RBF (squared exponential) kernel between inputs \(\mathbf{x_1}\) and \(\mathbf{x_2}\): \(k_{\text{RBF}}(\mathbf{x_1}, \mathbf{x_2}) = \theta_0 \exp \left ( -\frac{\|\mathbf{x_1} - \mathbf{x_2}\|^2} {2\theta_1^2} \right)\), where \(\theta_0\) is the amplitude parameter and \(\theta_1\) is the length scale parameter.
-
kernel_matrix
(x1: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], x2: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]¶ - Parameters
x1 (Tensor) – Feature data of shape (batch_size, history_length, num_features).
x2 (Tensor) – Feature data of shape (batch_size, history_length, num_features).
- Returns
RBF kernel matrix of shape (batch_size, history_length, history_length).
- Return type
Tensor
-
-
class
gluonts.mx.kernels.
PeriodicKernelOutput
[source]¶ Bases:
gluonts.mx.kernels._kernel_output.KernelOutputDict
-
args_dim
: Dict[str, int] = {'amplitude': 1, 'frequency': 1, 'length_scale': 1}¶
-
classmethod
domain_map
(F, amplitude, length_scale, frequency)[source]¶ This function applies the softmax to the Periodic Kernel hyper-parameters.
- Parameters
F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
amplitude – Periodic kernel amplitude hyper-parameter of shape (batch_size, 1, 1).
length_scale – Periodic kernel length scale hyper-parameter of of shape (batch_size, 1, 1).
frequency – Periodic kernel hyper-parameter of shape (batch_size, 1, 1).
- Returns
Three GP Periodic kernel hyper-parameters. Each is a Tensor of shape: (batch_size, 1, 1).
- Return type
Tuple[Tensor, Tensor, Tensor]
-
gp_params_scaling
(F, past_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]¶ This function returns the scales for the GP Periodic Kernel hyper-parameters by using the standard deviations of the past_target and past_time_features.
- Parameters
F (ModuleType) – A module that can either refer to the Symbol API or the NDArray API in MXNet.
past_target (Tensor) – Training time series values of shape (batch_size, context_length).
past_time_feat (Tensor) – Training features of shape (batch_size, context_length, num_features).
- Returns
Three scaled GP hyper-parameters for the Periodic Kernel and scaled model noise hyper-parameter. Each is a Tensor of shape (batch_size, 1, 1).
- Return type
Tuple
-
kernel_cls
¶ alias of
PeriodicKernel
-
-
class
gluonts.mx.kernels.
RBFKernelOutput
[source]¶ Bases:
gluonts.mx.kernels._kernel_output.KernelOutputDict
-
args_dim
: Dict[str, int] = {'amplitude': 1, 'length_scale': 1}¶
-
domain_map
(F, amplitude, length_scale)[source]¶ This function applies the softmax to the RBF Kernel hyper-parameters.
- Parameters
F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
amplitude – RBF kernel amplitude hyper-parameter of shape (batch_size, 1, 1).
length_scale – RBF kernel length scale hyper-parameter of of shape (batch_size, 1, 1).
- Returns
Two GP RBF kernel hyper-parameters. Each is a Tensor of shape: (batch_size, 1, 1).
- Return type
Tuple[Tensor, Tenspr]
-
gp_params_scaling
(F, past_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]¶ This function returns the scales for the GP RBF Kernel hyper-parameters by using the standard deviations of the past_target and past_time_features.
- Parameters
F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
past_target – Training time series values of shape (batch_size, context_length).
past_time_feat – Training features of shape (batch_size, context_length, num_features).
- Returns
Two scaled GP hyper-parameters for the RBF Kernel and scaled model noise hyper-parameter. Each is a Tensor of shape (batch_size, 1, 1).
- Return type
Tuple
-
-
class
gluonts.mx.kernels.
KernelOutput
[source]¶ Bases:
object
Class to connect a network to a kernel.
-
static
compute_std
(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], axis: int) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]¶ This function computes the standard deviation of the data along a given axis.
- Parameters
F (ModuleType) – A module that can either refer to the Symbol API or the NDArray API in MXNet.
data (Tensor) – Data to be used to compute the standard deviation.
axis (int) – Axis along which to compute the standard deviation.
- Returns
The standard deviation of the given data.
- Return type
Tensor
-
static
-
class
gluonts.mx.kernels.
KernelOutputDict
[source]¶ Bases:
gluonts.mx.kernels._kernel_output.KernelOutput
-
args_dim
: Dict[str, int] = None¶
-
get_args_proj
(float_type: gluonts.core.component.DType = <class 'numpy.float32'>) → gluonts.mx.distribution.distribution_output.ArgProj[source]¶ This method calls the ArgProj block in distribution_output to project from a dense layer to kernel arguments.
-
gp_params_scaling
(F, past_target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], past_time_feat: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → tuple[source]¶
-
kernel
(kernel_args) → gluonts.mx.kernels._kernel.Kernel[source]¶ - Parameters
kernel_args – Variable length argument list.
- Returns
Instantiated specified Kernel subclass object.
- Return type
-
kernel_cls
: type = None¶
-