public class LossBinaryXENT extends DifferentialFunction implements ILossFunction
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_CLIPPING_EPSILON |
dimensions, extraArgs, inPlace, sameDiff, scalarValue| 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
|
org.nd4j.linalg.primitives.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.
|
List<SDVariable> |
doDiff(List<SDVariable> f1)
The actual implementation for automatic differentiation.
|
void |
initFromOnnx(OnnxProto3.NodeProto node,
SameDiff initWith,
Map<String,OnnxProto3.AttributeProto> attributesForNode,
OnnxProto3.GraphProto graph)
Iniitialize the function from the given
OnnxProto3.NodeProto |
void |
initFromTensorFlow(NodeDef nodeDef,
SameDiff initWith,
Map<String,AttrValue> attributesForNode,
GraphDef graph)
Initialize the function from the given
NodeDef |
String |
name()
The opName of this function
|
String |
onnxName()
The opName of this function in onnx
|
String |
opName()
The name of the op
|
Op.Type |
opType()
The type of the op
|
SDVariable[] |
outputVariables()
Return the output variables for this differential function.
|
SDVariable[] |
outputVariables(String baseName)
Return the output functions for this differential function.
|
String |
tensorflowName()
The opName of this function tensorflow
|
String |
toString() |
arg, args, asProperties, attributeAdaptersForFunction, calculateOutputShape, configFieldName, diff, dup, equals, f, getValue, hashCode, hasPlaceHolderInputs, isConfigProperties, larg, mappingsForFunction, onnxNames, opNum, propertiesForFunction, rarg, resolvePropertiesFromSameDiffBeforeExecution, setInstanceId, setValueFor, tensorflowNamespublic 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)
ILossFunctioncomputeScore in interface ILossFunctionlabels - 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)
ILossFunctioncomputeScoreArray in interface ILossFunctionlabels - 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)
ILossFunctioncomputeGradient in interface ILossFunctionlabels - 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 org.nd4j.linalg.primitives.Pair<Double,INDArray> computeGradientAndScore(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask, boolean average)
ILossFunctionILossFunction.computeScore(INDArray, INDArray, IActivation, INDArray, boolean)
and ILossFunction.computeGradient(INDArray, INDArray, IActivation, INDArray) individuallycomputeGradientAndScore in interface ILossFunctionlabels - 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 ILossFunctionpublic SDVariable[] outputVariables()
DifferentialFunctionoutputVariables in class DifferentialFunctionpublic SDVariable[] outputVariables(String baseName)
DifferentialFunctionoutputVariables in class DifferentialFunctionpublic List<SDVariable> doDiff(List<SDVariable> f1)
DifferentialFunctiondoDiff in class DifferentialFunctionpublic void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
DifferentialFunctionNodeDefinitFromTensorFlow in class DifferentialFunctionpublic void initFromOnnx(OnnxProto3.NodeProto node, SameDiff initWith, Map<String,OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.GraphProto graph)
DifferentialFunctionOnnxProto3.NodeProtoinitFromOnnx in class DifferentialFunctionpublic String opName()
DifferentialFunctionopName in class DifferentialFunctionpublic Op.Type opType()
DifferentialFunctionopType in class DifferentialFunctionpublic String onnxName()
DifferentialFunctiononnxName in class DifferentialFunctionpublic String tensorflowName()
DifferentialFunctiontensorflowName in class DifferentialFunctionCopyright © 2018. All rights reserved.