public class OCNNOutputLayer extends BaseOutputLayer<OCNNOutputLayer>
OCNNOutputLayer
See OCNNOutputLayer
for details.Modifier and Type | Class and Description |
---|---|
class |
OCNNOutputLayer.OCNNLossFunction |
Layer.TrainingMode, Layer.Type
inputMaskArray, inputMaskArrayState, labels
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, weightNoiseParams
cacheMode, conf, dropoutApplied, dropoutMask, epochCount, index, input, iterationCount, maskArray, maskState, preOutput, trainingListeners
Constructor and Description |
---|
OCNNOutputLayer(NeuralNetConfiguration conf) |
OCNNOutputLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
Modifier and Type | Method and Description |
---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(org.nd4j.linalg.api.ndarray.INDArray input,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the specified input
|
org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> |
backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
double |
computeScore(double fullNetworkL1,
double fullNetworkL2,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Compute score after labels and input have been set.
|
org.nd4j.linalg.api.ndarray.INDArray |
computeScoreForExamples(double fullNetworkL1,
double fullNetworkL2,
LayerWorkspaceMgr workspaceMgr)
Compute the score for each example individually, after labels and input have been set.
|
double |
f1Score(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Returns the f1 score for the given examples.
|
org.nd4j.linalg.api.ndarray.INDArray |
getLabels()
Get the labels array previously set with
IOutputLayer.setLabels(INDArray) |
protected org.nd4j.linalg.api.ndarray.INDArray |
getLabels2d(LayerWorkspaceMgr workspaceMgr,
ArrayType arrayType) |
org.nd4j.linalg.api.ndarray.INDArray |
labelProbabilities(org.nd4j.linalg.api.ndarray.INDArray examples)
Returns the probabilities for each label
for each example row wise
|
boolean |
needsLabels()
Returns true if labels are required
for this output layer
|
protected org.nd4j.linalg.api.ndarray.INDArray |
preOutput2d(boolean training,
LayerWorkspaceMgr workspaceMgr) |
void |
setLabels(org.nd4j.linalg.api.ndarray.INDArray labels)
Set the labels array for this output layer
|
Layer.Type |
type()
Returns the layer type
|
applyMask, clear, computeGradientAndScore, f1Score, fit, fit, fit, fit, fit, gradient, gradientAndScore, hasBias, isPretrainLayer, numLabels, predict, predict, setScoreWithZ
accumulateScore, calcL1, calcL2, clearNoiseWeightParams, clone, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, initParams, layerConf, numParams, params, paramTable, paramTable, preOutput, score, setBackpropGradientsViewArray, setParam, setParams, setParams, setParamsViewArray, setParamTable, toString, transpose, update, update
addListeners, applyConstraints, applyDropOutIfNecessary, assertInputSet, batchSize, conf, feedForwardMaskArray, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, init, input, layerId, numParams, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, validateInput
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
calcL1, calcL2, clearNoiseWeightParams, clone, feedForwardMaskArray, getEpochCount, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, setCacheMode, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, transpose
accumulateScore, addListeners, applyConstraints, batchSize, conf, fit, getGradientsViewArray, getOptimizer, getParam, init, initParams, input, numParams, numParams, params, paramTable, paramTable, score, setBackpropGradientsViewArray, setConf, setParam, setParams, setParamsViewArray, setParamTable, update, update, validateInput
public OCNNOutputLayer(NeuralNetConfiguration conf)
public OCNNOutputLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public org.nd4j.linalg.api.ndarray.INDArray getLabels()
IOutputLayer
IOutputLayer.setLabels(INDArray)
getLabels
in interface IOutputLayer
getLabels
in class BaseOutputLayer<OCNNOutputLayer>
public void setLabels(org.nd4j.linalg.api.ndarray.INDArray labels)
IOutputLayer
setLabels
in interface IOutputLayer
setLabels
in class BaseOutputLayer<OCNNOutputLayer>
labels
- Labels array to setpublic double computeScore(double fullNetworkL1, double fullNetworkL2, boolean training, LayerWorkspaceMgr workspaceMgr)
computeScore
in interface IOutputLayer
computeScore
in class BaseOutputLayer<OCNNOutputLayer>
fullNetworkL1
- L1 regularization term for the entire networkfullNetworkL2
- L2 regularization term for the entire networktraining
- whether score should be calculated at train or test time (this affects things like application of
dropout, etc)public boolean needsLabels()
IOutputLayer
needsLabels
in interface IOutputLayer
needsLabels
in class BaseOutputLayer<OCNNOutputLayer>
public org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layer
backpropGradient
in interface Layer
backpropGradient
in class BaseOutputLayer<OCNNOutputLayer>
epsilon
- w^(L+1)*delta^(L+1). Or, equiv: dC/da, i.e., (dC/dz)*(dz/da) = dC/da, where C
is cost function a=sigma(z) is activation.workspaceMgr
- Workspace managerArrayType.ACTIVATION_GRAD
workspace via the workspace managerpublic org.nd4j.linalg.api.ndarray.INDArray activate(org.nd4j.linalg.api.ndarray.INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)
Layer
activate
in interface Layer
activate
in class BaseOutputLayer<OCNNOutputLayer>
input
- the input to usetraining
- train or test modeworkspaceMgr
- Workspace manager.ArrayType.ACTIVATIONS
workspace via the workspace managerpublic double f1Score(org.nd4j.linalg.api.ndarray.INDArray examples, org.nd4j.linalg.api.ndarray.INDArray labels)
f1Score
in interface Classifier
f1Score
in class BaseOutputLayer<OCNNOutputLayer>
examples
- te the examples to classify (one example in each row)labels
- the true labelspublic org.nd4j.linalg.api.ndarray.INDArray labelProbabilities(org.nd4j.linalg.api.ndarray.INDArray examples)
BaseOutputLayer
labelProbabilities
in interface Classifier
labelProbabilities
in class BaseOutputLayer<OCNNOutputLayer>
examples
- the examples to classify (one example in each row)public Layer.Type type()
Layer
type
in interface Layer
type
in class AbstractLayer<OCNNOutputLayer>
protected org.nd4j.linalg.api.ndarray.INDArray preOutput2d(boolean training, LayerWorkspaceMgr workspaceMgr)
preOutput2d
in class BaseOutputLayer<OCNNOutputLayer>
protected org.nd4j.linalg.api.ndarray.INDArray getLabels2d(LayerWorkspaceMgr workspaceMgr, ArrayType arrayType)
getLabels2d
in class BaseOutputLayer<OCNNOutputLayer>
public org.nd4j.linalg.api.ndarray.INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layer
activate
in interface Layer
activate
in class BaseLayer<OCNNOutputLayer>
training
- training or test modeworkspaceMgr
- Workspace managerArrayType.ACTIVATIONS
workspace via the workspace managerpublic org.nd4j.linalg.api.ndarray.INDArray computeScoreForExamples(double fullNetworkL1, double fullNetworkL2, LayerWorkspaceMgr workspaceMgr)
computeScoreForExamples
in interface IOutputLayer
computeScoreForExamples
in class BaseOutputLayer<OCNNOutputLayer>
fullNetworkL1
- L1 regularization term for the entire network (or, 0.0 to not include regularization)fullNetworkL2
- L2 regularization term for the entire network (or, 0.0 to not include regularization)Copyright © 2018. All rights reserved.