public class LossBinaryXENT extends Object implements ILossFunction
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_CLIPPING_EPSILON |
Constructor and Description |
---|
LossBinaryXENT() |
LossBinaryXENT(double clipEps)
Binary cross entropy where each the output is
(optionally) weighted/scaled by a fixed scalar value.
|
LossBinaryXENT(double clipEps,
INDArray weights)
Binary cross entropy where each the output is
(optionally) weighted/scaled by a fixed scalar value.
|
LossBinaryXENT(INDArray weights)
Binary cross entropy where each the output is
(optionally) weighted/scaled by a fixed scalar value.
|
Modifier and Type | Method and Description |
---|---|
INDArray |
computeGradient(INDArray labels,
INDArray preOutput,
IActivation activationFn,
INDArray mask)
Compute the gradient of the loss function with respect to the inputs: dL/dOutput
|
Pair<Double,INDArray> |
computeGradientAndScore(INDArray labels,
INDArray preOutput,
IActivation activationFn,
INDArray mask,
boolean average)
Compute both the score (loss function value) and gradient.
|
double |
computeScore(INDArray labels,
INDArray preOutput,
IActivation activationFn,
INDArray mask,
boolean average)
Compute the score (loss function value) for the given inputs.
|
INDArray |
computeScoreArray(INDArray labels,
INDArray preOutput,
IActivation activationFn,
INDArray mask)
Compute the score (loss function value) for each example individually.
|
String |
name()
The opName of this function
|
String |
toString() |
public static final double DEFAULT_CLIPPING_EPSILON
public LossBinaryXENT()
public LossBinaryXENT(INDArray weights)
weights
- Weights array (row vector). May be null.public LossBinaryXENT(double clipEps)
clipEps
- Epsilon value for clipping. Probabilities are clipped in range of [eps, 1-eps]. Default eps: 1e-5public LossBinaryXENT(double clipEps, INDArray weights)
clipEps
- Epsilon value for clipping. Probabilities are clipped in range of [eps, 1-eps]. Default eps: 1e-5weights
- Weights array (row vector). May be null.public double computeScore(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask, boolean average)
ILossFunction
computeScore
in interface ILossFunction
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 valuepublic INDArray computeScoreArray(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask)
ILossFunction
computeScoreArray
in interface ILossFunction
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 vectorpublic INDArray computeGradient(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask)
ILossFunction
computeGradient
in interface ILossFunction
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 nullpublic Pair<Double,INDArray> computeGradientAndScore(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask, boolean average)
ILossFunction
ILossFunction.computeScore(INDArray, INDArray, IActivation, INDArray, boolean)
and ILossFunction.computeGradient(INDArray, INDArray, IActivation, INDArray)
individuallycomputeGradientAndScore
in interface ILossFunction
labels
- 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 notpublic String name()
name
in interface ILossFunction
Copyright © 2020. All rights reserved.