org.encog.neural.networks.layers
Class BasicLayer
- java.lang.Object
-
- org.encog.neural.flat.FlatLayer
-
- org.encog.neural.networks.layers.BasicLayer
-
- All Implemented Interfaces:
- java.io.Serializable, Layer
public class BasicLayer extends FlatLayer implements Layer, java.io.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)- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BasicLayer(ActivationFunction activationFunction, boolean hasBias, int neuronCount)BasicLayer(ActivationFunction activationFunction, boolean hasBias, int neuronCount, double dropoutRate)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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ActivationFunctiongetActivationFunction()BasicNetworkgetNetwork()intgetNeuronCount()voidsetNetwork(BasicNetwork network)Set the network for this layer.-
Methods inherited from class org.encog.neural.flat.FlatLayer
getActivation, getBiasActivation, getContextCount, getContextFedBy, getCount, getDropoutRate, getTotalCount, hasBias, setActivation, setBiasActivation, setContextFedBy, setDropoutRate, toString
-
Methods inherited from class java.lang.Object
equals, 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, double dropoutRate)
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.dropoutRate- The dropout rate for this layer
-
BasicLayer
public BasicLayer(ActivationFunction activationFunction, boolean hasBias, int neuronCount)
-
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:
getNetworkin interfaceLayer- Returns:
- The network that owns this layer.
-
setNetwork
public void setNetwork(BasicNetwork network)
Set the network for this layer.- Specified by:
setNetworkin interfaceLayer- Parameters:
network- The network for this layer.
-
getNeuronCount
public int getNeuronCount()
- Specified by:
getNeuronCountin interfaceLayer- Returns:
- The neuron count.
-
getActivationFunction
public ActivationFunction getActivationFunction()
- Specified by:
getActivationFunctionin interfaceLayer- Returns:
- The activation function used for this layer.
-
-
DMelt 3.0 © DataMelt by jWork.ORG