org.encog.neural.networks.layers
Class BasicLayer

java.lang.Object
  extended by org.encog.neural.flat.FlatLayer
      extended by org.encog.neural.networks.layers.BasicLayer
All Implemented Interfaces:
Serializable, Layer

public class BasicLayer
extends FlatLayer
implements Layer, Serializable

Basic functionality that most of the neural layers require. The basic layer is often used by itself to implement forward or recurrent layers. Other layer types are based on the basic layer as well. The following summarizes how basic layers calculate the output for a neural network. Example of a simple XOR network. Input: BasicLayer: 2 Neurons, null biasWeights, null biasActivation Hidden: BasicLayer: 2 Neurons, 2 biasWeights, 1 biasActivation Output: BasicLayer: 1 Neuron, 1 biasWeights, 1 biasActivation Input1Output and Input2Output are both provided. Synapse 1: Input to Hidden Hidden1Activation = (Input1Output * Input1->Hidden1Weight) + (Input2Output * Input2->Hidden1Weight) + (HiddenBiasActivation * Hidden1BiasWeight) Hidden1Output = calculate(Hidden1Activation, HiddenActivationFunction) Hidden2Activation = (Input1Output * Input1->Hidden2Weight) + (Input2Output * Input2->Hidden2Weight) + (HiddenBiasActivation * Hidden2BiasWeight) Hidden2Output = calculate(Hidden2Activation, HiddenActivationFunction) Synapse 2: Hidden to Output Output1Activation = (Hidden1Output * Hidden1->Output1Weight) + (Hidden2Output * Hidden2->Output1Weight) + (OutputBiasActivation * Output1BiasWeight) Output1Output = calculate(Output1Activation, OutputActivationFunction)

Author:
jheaton
See Also:
Serialized Form

Constructor Summary
BasicLayer(ActivationFunction activationFunction, boolean hasBias, int neuronCount)
          Construct this layer with a non-default activation function, also determine if a bias is desired or not.
BasicLayer(int neuronCount)
          Construct this layer with a sigmoid activation function.
 
Method Summary
 ActivationFunction getActivationFunction()
           
 BasicNetwork getNetwork()
           
 int getNeuronCount()
           
 void setNetwork(BasicNetwork network)
          Set the network for this layer.
 
Methods inherited from class org.encog.neural.flat.FlatLayer
getActivation, getBiasActivation, getContextCount, getContextFedBy, getCount, getTotalCount, hasBias, setActivation, setBiasActivation, setContextFedBy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.encog.neural.networks.layers.Layer
getBiasActivation, hasBias, setActivation, setBiasActivation
 

Constructor Detail

BasicLayer

public BasicLayer(ActivationFunction activationFunction,
                  boolean hasBias,
                  int neuronCount)
Construct this layer with a non-default activation function, also determine if a bias is desired or not.

Parameters:
activationFunction - The activation function to use.
neuronCount - How many neurons in this layer.
hasBias - True if this layer has a bias.

BasicLayer

public BasicLayer(int neuronCount)
Construct this layer with a sigmoid activation function.

Parameters:
neuronCount - How many neurons in this layer.
Method Detail

getNetwork

public BasicNetwork getNetwork()
Specified by:
getNetwork in interface Layer
Returns:
The network that owns this layer.

setNetwork

public void setNetwork(BasicNetwork network)
Set the network for this layer.

Specified by:
setNetwork in interface Layer
Parameters:
network - The network for this layer.

getNeuronCount

public int getNeuronCount()
Specified by:
getNeuronCount in interface Layer
Returns:
The neuron count.

getActivationFunction

public ActivationFunction getActivationFunction()
Specified by:
getActivationFunction in interface Layer
Returns:
The activation function used for this layer.


Copyright © 2014. All Rights Reserved.