Feyn

Feyn

  • Tutorials
  • Guides
  • API Reference
  • FAQ

›Feyn

Feyn

  • feyn
  • feyn.extra
  • feyn.filters
  • feyn.inference
  • feyn.insights
  • feyn.losses
  • feyn.metrics
  • feyn.plots
  • feyn.reference
  • feyn.tools

Future

  • feyn.__future__
  • feyn.__future__.contrib
  • feyn.__future__.contrib.diagnostics
  • feyn.__future__.contrib.filters
  • feyn.__future__.contrib.inspection
  • feyn.__future__.contrib.reference

feyn.losses

A collection of loss functions for use with feyn.

The loss funtions can be specified as arguments to the `QGraph.fit()` and `QGraph.sort()` methods. 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 the graphs in a QGraph.

function absolute_error

def absolute_error(
    y_true: numpy.ndarray,
    y_pred: numpy.ndarray
) -> numpy.ndarray
Compute the absolute error loss.

Arguments:
    y_true -- Ground truth (correct) target values.
    y_pred -- Predicted values.

Returns:
    nd.array -- The losses as an array of floats.

function binary_cross_entropy

def binary_cross_entropy(
    y_true: numpy.ndarray,
    y_pred: numpy.ndarray
) -> numpy.ndarray
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 QGraphs with output data that is not binary. Doing so will result in a RuntimeError.

Arguments:
    y_true -- Ground truth (correct) target values.
    y_pred -- Predicted values.

Returns:
    nd.array -- The losses as an array of floats.

function categorical_cross_entropy

def categorical_cross_entropy(
    y_true: numpy.ndarray,
    y_pred: numpy.ndarray
) -> numpy.ndarray
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 QGraphs with output data that is not binary. Doing so will result in a RuntimeError.

Arguments:
    y_true -- Ground truth (correct) target values.
    y_pred -- Predicted values.

Returns:
    nd.array -- The losses as an array of floats.

function squared_error

def squared_error(
    y_true: numpy.ndarray,
    y_pred: numpy.ndarray
) -> numpy.ndarray
Compute the squared error loss.

This is the default loss function used in fitting and selecting graphs from QGraphs.

Arguments:
    y_true -- Ground truth (correct) target values.
    y_pred -- Predicted values.

Returns:
    nd.array -- The losses as an array of floats.
← feyn.insightsfeyn.metrics →
  • function absolute_error
  • function binary_cross_entropy
  • function categorical_cross_entropy
  • function squared_error
Copyright © 2021 Abzu.ai