public class LossMAE extends LossL1
LossL1
for a mathematically similar loss function (LossL1 does not have division by N, where N is output size)dimensions, extraArgs, inPlace, sameDiff, scalarValue
Constructor and Description |
---|
LossMAE() |
LossMAE(INDArray weights)
Mean Absolute Error loss function where each the output is (optionally) weighted/scaled by a flags 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
|
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
|
String |
tensorflowName()
The opName of this function tensorflow
|
String |
toString() |
computeGradientAndScore, outputVariables, outputVariables, scoreArray
arg, args, asProperties, attributeAdaptersForFunction, calculateOutputShape, configFieldName, diff, dup, equals, f, getValue, hashCode, hasPlaceHolderInputs, isConfigProperties, larg, mappingsForFunction, onnxNames, opNum, propertiesForFunction, rarg, resolvePropertiesFromSameDiffBeforeExecution, setInstanceId, setValueFor, tensorflowNames
public LossMAE()
public LossMAE(INDArray weights)
weights
- 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
computeScore
in class LossL1
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
computeScoreArray
in class LossL1
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
computeGradient
in class LossL1
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 String name()
name
in interface ILossFunction
name
in class LossL1
public List<SDVariable> doDiff(List<SDVariable> f1)
DifferentialFunction
public String opName()
DifferentialFunction
public Op.Type opType()
DifferentialFunction
public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
DifferentialFunction
NodeDef
initFromTensorFlow
in class LossL1
public void initFromOnnx(OnnxProto3.NodeProto node, SameDiff initWith, Map<String,OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.GraphProto graph)
DifferentialFunction
OnnxProto3.NodeProto
initFromOnnx
in class LossL1
public String onnxName()
DifferentialFunction
public String tensorflowName()
DifferentialFunction
tensorflowName
in class LossL1
Copyright © 2018. All rights reserved.