Loss Functions (qiskit_machine_learning.utils.loss_functions)

A collection of common loss functions to be used with the classifiers and regressors provided by Qiskit Machine Learning.

Loss Function Base Class

Loss

Abstract base class for computing Loss.

KernelLoss

Abstract base class for computing the loss of a kernel function.

Loss Functions

L1Loss

This class computes the L1 loss (i.e. absolute error) for each sample as:.

L2Loss

This class computes the L2 loss (i.e. squared error) for each sample as:.

CrossEntropyLoss

This class computes the cross entropy loss for each sample as:

SVCLoss

This class provides a kernel loss function for classification tasks by fitting an SVC model from scikit-learn.