Package deepnetts.net.layers
Class OutputLayer
- All Implemented Interfaces:
 Layer<TensorBase>,Serializable
- Direct Known Subclasses:
 SoftmaxOutputLayer
Output layer of a neural network.
 It is always the last layer in a neural network, and gives the final output of a network.
- See Also:
 
- 
Constructor Summary
ConstructorsConstructorDescriptionOutputLayer(int width) Creates an instance of output layer with specified width (number of outputs) and sigmoid activation function by default.OutputLayer(int width, ActivationType actType) Creates an instance of output layer with specified width (number of outputs) and specified activation function.OutputLayer(String[] outputLabels, ActivationType actType) Creates an instance of output layer with specified width (number of outputs) and linear activation function by default. - 
Method Summary
Modifier and TypeMethodDescriptionvoidApplies weight changes after one learning iteration or batchvoidbackward()This method implements backward pass for the output layer.voidforward()This method implements forward pass for the output layer.final LossTypefinal TensorBasefloatvoidinit()This method should implement layer initialization in subclasses, when a layer is added to the network (create weights, outputs, deltas, randomization etc.).voidsetLossType(LossType lossType) final voidsetOutputErrors(TensorBase outputErrors) toString()Methods inherited from class deepnetts.net.layers.AbstractLayer
getActivation, getActivationType, getBatchSize, getBiases, getDeltaBiases, getDeltas, getDeltaWeights, getDepth, getForwardAccelerator, getGradients, getHeight, getL1Regularization, getL1WeightSum, getL2Regularization, getL2WeightSum, getLearningRate, getMode, getMomentum, getNextLayer, getOptimizer, getOptimizerType, getOutputs, getPrevDeltaBiases, getPrevDeltaWeights, getPrevlayer, getWeights, getWidth, initTransientFields, isBatchMode, isTrainable, setBatchMode, setBatchSize, setBiases, setCudaHandles, setDeltas, setL1Regularization, setL2Regularization, setLearningRate, setMode, setMomentum, setNextlayer, setOptimizerType, setOutputs, setPrevDeltaWeights, setPrevLayer, setThreadPool, setTrainable, setWeights, setWeights 
- 
Constructor Details
- 
OutputLayer
public OutputLayer(int width) Creates an instance of output layer with specified width (number of outputs) and sigmoid activation function by default. Outputs are labeled using generic names "Output1, 2, 3..."- Parameters:
 width- layer width which represents number of network outputs
 - 
OutputLayer
Creates an instance of output layer with specified width (number of outputs) and specified activation function. Outputs are labeled using generic names "Output1, 2, 3..."- Parameters:
 width- layer width whic represents number of network outputsactType- activation function
 - 
OutputLayer
Creates an instance of output layer with specified width (number of outputs) and linear activation function by default. Typically linear activation is used for regression tasks, while sigmoid activation is used for binary classification problems.- Parameters:
 outputLabels- labels for network's outputs
 
 - 
 - 
Method Details
- 
setOutputErrors
 - 
getOutputErrors
 - 
getLossType
 - 
setLossType
 - 
init
public void init()Description copied from class:AbstractLayerThis method should implement layer initialization in subclasses, when a layer is added to the network (create weights, outputs, deltas, randomization etc.).- Specified by:
 initin classAbstractLayer<TensorBase,TensorBase, Tensor2D> 
 - 
forward
public void forward()This method implements forward pass for the output layer. Calculates weighted input and layer outputs using sigmoid function.- Specified by:
 forwardin interfaceLayer<TensorBase>- Specified by:
 forwardin classAbstractLayer<TensorBase,TensorBase, Tensor2D> 
 - 
backward
public void backward()This method implements backward pass for the output layer. http://peterroelants.github.io/posts/neural_network_implementation_intermezzo01/ http://neuralnetworksanddeeplearning.com/chap3.html#introducing_the_cross-entropy_cost_function http://neuralnetworksanddeeplearning.com/chap3.html- Specified by:
 backwardin interfaceLayer<TensorBase>- Specified by:
 backwardin classAbstractLayer<TensorBase,TensorBase, Tensor2D> 
 - 
applyWeightChanges
public void applyWeightChanges()Applies weight changes after one learning iteration or batch- Specified by:
 applyWeightChangesin classAbstractLayer<TensorBase,TensorBase, Tensor2D> 
 - 
toString
 - 
getSingleOutInput
public float getSingleOutInput() 
 -