TrainableKernel#

class TrainableKernel(*, training_parameters=None, **kwargs)[kaynak]#

Bases: BaseKernel, ABC

An abstract definition of the ability to train kernel via specifying training parameters.

Parametreler:
  • training_parameters (ParameterVector | Sequence[Parameter] | None) – a sequence of training parameters.

  • **kwargs – Additional parameters may be used by the super class.

Attributes

enforce_psd#

Returns True if the kernel matrix is required to project to the closest positive semidefinite matrix.

feature_map#

Returns the feature map of this kernel.

num_features#

Returns the number of features in this kernel.

num_training_parameters#

Returns the number of training parameters.

parameter_values#

Returns numerical values assigned to the training parameters as a numpy array.

training_parameters#

Returns the vector of training parameters.

Methods

assign_training_parameters(parameter_values)[kaynak]#

Fix the training parameters to numerical values.

abstract evaluate(x_vec, y_vec=None)#

Construct kernel matrix for given data.

If y_vec is None, self inner product is calculated.

Parametreler:
  • x_vec (ndarray) – 1D or 2D array of datapoints, NxD, where N is the number of datapoints, D is the feature dimension

  • y_vec (ndarray | None) – 1D or 2D array of datapoints, MxD, where M is the number of datapoints, D is the feature dimension

Dönüşler:

2D matrix, NxM

Dönüş türü:

ndarray