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.

SVRLoss

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

MSRLoss

This class provides a simple mean squared regression loss function by fitting an SVR model from scikit-learn and computing the mean squared error on the training set.

MARLoss

This class provides a mean absolute regression loss function by fitting an SVR model from scikit-learn and computing the mean absolute error on the training set.

HuberLoss

This class provides a Huber loss function for regression.