squlearn.kernel.loss.kernel_loss_base
.KernelLossBase
- class squlearn.kernel.loss.kernel_loss_base.KernelLossBase
Empty parent class for a kernel loss function.
- abstract compute(quantum_kernel: KernelMatrixBase, parameter_values: array, data: ndarray, labels: ndarray) float
Compute the target alignment loss.
- Parameters:
quantum_kernel (KernelMatrixBase) – The quantum kernel matrix to be used in the loss.
parameter_values (np.ndarray) – The parameter values for the variational quantum kernel parameters.
data (np.ndarray) – The training data to be used for the kernel matrix.
labels (np.ndarray) – The training labels.
- Returns:
The loss value.
- Return type:
float
- set_quantum_kernel(quantum_kernel: KernelMatrixBase) None
Set the quantum kernel matrix to be used in the loss.
- Parameters:
quantum_kernel (KernelMatrixBase) – The quantum kernel matrix to be used in the loss.