A collection of loss functions for use with feyn.
The loss funtions can be specified as arguments to the `feyn.fit_models` method. A good choice of loss function can sometimes speed up the training. For most uses the default loss function, `squared_error` is a fine choice.
Note: Data scientist with experience from other frameworks may be used to thinking that the loss function is very significant. In practice it matters less in QLattices, for reasons that have to do with the large range of initial parameters for models.
Compute the absolute error loss.
Arguments:
y_true -- Ground truth (correct) values.
y_pred -- Predicted values.
Returns:
nd.array -- The losses as an array of floats.
Compute the cross entropy loss between the labels and predictions.
This is a good alternative choice for binary classification problems. If cannot be used for fitting models with output data that is not binary. Doing so will result in a RuntimeError.
Arguments:
y_true -- Ground truth (correct) values.
y_pred -- Predicted values.
Returns:
nd.array -- The losses as an array of floats.
Compute the cross entropy loss between the labels and predictions.
This is a good alternative choice for binary classification problems. If cannot be used for fitting models with output data that is not binary. Doing so will result in a RuntimeError.
Arguments:
y_true -- Ground truth (correct) values.
y_pred -- Predicted values.
Returns:
nd.array -- The losses as an array of floats.
Compute the squared error loss.
This is the default loss function used in fitting and sampling models from the QLattice.
Arguments:
y_true -- Ground truth (correct) values.
y_pred -- Predicted values.
Returns:
nd.array -- The losses as an array of floats.