public interface ILossFunction extends Serializable
Modifier and Type | Method and Description |
---|---|
INDArray |
computeGradient(INDArray labels,
INDArray preOutput,
String activationFn,
INDArray mask)
Compute the gradient of the loss function with respect to the inputs: dL/dOutput
|
org.apache.commons.math3.util.Pair<Double,INDArray> |
computeGradientAndScore(INDArray labels,
INDArray preOutput,
String activationFn,
INDArray mask,
boolean average)
Compute both the score (loss function value) and gradient.
|
double |
computeScore(INDArray labels,
INDArray preOutput,
String activationFn,
INDArray mask,
boolean average)
Compute the score (loss function value) for the given inputs.
|
INDArray |
computeScoreArray(INDArray labels,
INDArray preOutput,
String activationFn,
INDArray mask)
Compute the score (loss function value) for each example individually.
|
double computeScore(INDArray labels, INDArray preOutput, String activationFn, INDArray mask, boolean average)
labels
- Label/expected preOutputpreOutput
- Output of the model (neural network)activationFn
- Activation function that should be applied to preOutputmask
- Mask array; may be nullaverage
- Whether the score should be averaged (divided by number of rows in labels/preOutput) or not @return Loss function valueINDArray computeScoreArray(INDArray labels, INDArray preOutput, String activationFn, INDArray mask)
labels
- Labels/expected outputpreOutput
- Output of the model (neural network)activationFn
- Activation function that should be applied to preOutputmask
- @return Loss function value for each example; column vectorINDArray computeGradient(INDArray labels, INDArray preOutput, String activationFn, INDArray mask)
labels
- Label/expected outputpreOutput
- Output of the model (neural network), before the activation function is appliedactivationFn
- Activation function that should be applied to preOutputmask
- Mask array; may be nullorg.apache.commons.math3.util.Pair<Double,INDArray> computeGradientAndScore(INDArray labels, INDArray preOutput, String activationFn, INDArray mask, boolean average)
computeScore(INDArray, INDArray, String, INDArray, boolean)
and computeGradient(INDArray, INDArray, String, INDArray)
individuallylabels
- Label/expected outputpreOutput
- Output of the model (neural network)activationFn
- Activation function that should be applied to preOutputmask
- Mask array; may be nullaverage
- Whether the score should be averaged (divided by number of rows in labels/output) or notCopyright © 2016. All Rights Reserved.