public class OCNNOutputLayer extends BaseOutputLayer<OCNNOutputLayer>
OCNNOutputLayer
See OCNNOutputLayer
for details.| Modifier and Type | Class and Description |
|---|---|
class |
OCNNOutputLayer.OCNNLossFunction |
Layer.TrainingMode, Layer.TypeinputMaskArray, inputMaskArrayState, labelsgradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, weightNoiseParamscacheMode, conf, dataType, dropoutApplied, epochCount, index, input, inputModificationAllowed, iterationCount, maskArray, maskState, preOutput, trainingListeners| Constructor and Description |
|---|
OCNNOutputLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.buffer.DataType dataType) |
| Modifier and Type | Method and Description |
|---|---|
INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
INDArray |
activate(INDArray input,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the specified input
|
Pair<Gradient,INDArray> |
backpropGradient(INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
double |
computeScore(double fullNetRegTerm,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Compute score after labels and input have been set.
|
INDArray |
computeScoreForExamples(double fullNetRegTerm,
LayerWorkspaceMgr workspaceMgr)
Compute the score for each example individually, after labels and input have been set.
|
double |
f1Score(INDArray examples,
INDArray labels)
Returns the f1 score for the given examples.
|
protected INDArray |
getLabels2d(LayerWorkspaceMgr workspaceMgr,
ArrayType arrayType) |
boolean |
needsLabels()
Returns true if labels are required
for this output layer
|
protected INDArray |
preOutput2d(boolean training,
LayerWorkspaceMgr workspaceMgr) |
void |
setLabels(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, getLabels, gradient, gradientAndScore, hasBias, isPretrainLayer, numLabels, predict, predict, setScoreWithZcalcRegularizationScore, clearNoiseWeightParams, clone, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, hasLayerNorm, layerConf, numParams, params, paramTable, paramTable, preOutput, preOutputWithPreNorm, score, setBackpropGradientsViewArray, setParam, setParams, setParams, setParamsViewArray, setParamTable, toString, update, updateaddListeners, allowInputModification, applyConstraints, applyDropOutIfNecessary, assertInputSet, backpropDropOutIfPresent, batchSize, conf, feedForwardMaskArray, getConfig, getEpochCount, getHelper, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, init, input, layerId, numParams, setCacheMode, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, updaterDivideByMinibatchequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitallowInputModification, calcRegularizationScore, clearNoiseWeightParams, feedForwardMaskArray, getEpochCount, getHelper, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, setCacheMode, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArraygetConfig, getGradientsViewArray, numParams, params, paramTable, updaterDivideByMinibatchaddListeners, applyConstraints, batchSize, conf, fit, getGradientsViewArray, getOptimizer, getParam, init, input, numParams, numParams, params, paramTable, paramTable, score, setBackpropGradientsViewArray, setConf, setParam, setParams, setParamsViewArray, setParamTable, update, updatepublic OCNNOutputLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.buffer.DataType dataType)
public void setLabels(INDArray labels)
IOutputLayersetLabels in interface IOutputLayersetLabels in class BaseOutputLayer<OCNNOutputLayer>labels - Labels array to setpublic double computeScore(double fullNetRegTerm,
boolean training,
LayerWorkspaceMgr workspaceMgr)
computeScore in interface IOutputLayercomputeScore in class BaseOutputLayer<OCNNOutputLayer>fullNetRegTerm - Regularization score 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()
IOutputLayerneedsLabels in interface IOutputLayerneedsLabels in class BaseOutputLayer<OCNNOutputLayer>public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
LayerbackpropGradient in interface LayerbackpropGradient 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 INDArray activate(INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layeractivate in class BaseOutputLayer<OCNNOutputLayer>input - the input to usetraining - train or test modeworkspaceMgr - Workspace manager.ArrayType.ACTIVATIONS workspace via the workspace managerpublic double f1Score(INDArray examples, INDArray labels)
f1Score in interface Classifierf1Score in class BaseOutputLayer<OCNNOutputLayer>examples - te the examples to classify (one example in each row)labels - the true labelspublic Layer.Type type()
Layertype in interface Layertype in class AbstractLayer<OCNNOutputLayer>protected INDArray preOutput2d(boolean training, LayerWorkspaceMgr workspaceMgr)
preOutput2d in class BaseOutputLayer<OCNNOutputLayer>protected INDArray getLabels2d(LayerWorkspaceMgr workspaceMgr, ArrayType arrayType)
getLabels2d in class BaseOutputLayer<OCNNOutputLayer>public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layeractivate in class BaseLayer<OCNNOutputLayer>training - training or test modeworkspaceMgr - Workspace managerArrayType.ACTIVATIONS workspace via the workspace managerpublic INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr)
computeScoreForExamples in interface IOutputLayercomputeScoreForExamples in class BaseOutputLayer<OCNNOutputLayer>fullNetRegTerm - Regularization score term for the entire network (or, 0.0 to not include regularization)Copyright © 2019. All rights reserved.