org.encog.neural.networks.layers
Interface Layer

All Superinterfaces:
Comparable<Layer>, EncogPersistedObject, Serializable
All Known Implementing Classes:
BasicLayer, ContextLayer, RadialBasisFunctionLayer

public interface Layer
extends EncogPersistedObject, Comparable<Layer>

This interface defines all necessary methods for a neural network layer.

Author:
jheaton

Method Summary
 void addNext(Layer next)
          Add a layer to this layer.
 void addNext(Layer next, SynapseType type)
          Add a layer to this layer.
 void addSynapse(Synapse synapse)
          This method adds a synapse to the neural network.
 NeuralData compute(NeuralData pattern)
          Compute the output for this layer.
 ActivationFunction getActivationFunction()
           
 double getBiasActivation()
          Most layer types will default this value to one.
 double getBiasWeight(int index)
          Get an bias weight value.
 double[] getBiasWeights()
           
 int getID()
           
 BasicNetwork getNetwork()
           
 int getNeuronCount()
           
 List<Synapse> getNext()
          Get a list of all of the outbound synapse connections from this layer.
 Collection<Layer> getNextLayers()
           
 int getX()
           
 int getY()
           
 boolean hasBias()
           
 boolean isConnectedTo(Layer layer)
          Determine if this layer is connected to another.
 void process(NeuralData pattern)
          Process the data before it is modified by this layer.
 NeuralData recur()
          Called on recurrent layers to provide recurrent output.
 void setActivationFunction(ActivationFunction activationFunction)
          Set a new activation function for this layer.
 void setBiasActivation(double activation)
          Most layer types will default this value to one.
 void setBiasWeight(int index, double d)
          Set an individual bias weight value.
 void setBiasWeights(double[] d)
          Set the bias weight array for this layer.
 void setID(int id)
          Set the id for this layer.
 void setNetwork(BasicNetwork network)
          Set the network that this layer belongs to.
 void setNeuronCount(int neuronCount)
          Set the neuron count, this will NOT adjust the synapses or bias weights other code must do that.
 void setX(int x)
          Set the x coordinate.
 void setY(int y)
          Set the y coordinate.
 
Methods inherited from interface org.encog.persist.EncogPersistedObject
createPersistor, getCollection, getDescription, getName, setCollection, setDescription, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

addNext

void addNext(Layer next)
Add a layer to this layer. The "next" layer being added will receive input from this layer. You can also add a layer to itself, this will create a self-connected layer. This method will create a weighted synapse connection between this layer and the next. Layers can also have bias values attached. This makes up sort of "virtual layer" that connects to this layer. This allows you to specify a bias activation connected via bias weights to the neurons of this level. The bias weights and bias activations are set by the biasWeights and biasActivation properties.

Parameters:
next - The layer that is to be added.

addNext

void addNext(Layer next,
             SynapseType type)
Add a layer to this layer. The "next" layer being added will receive input from this layer. You can also add a layer to itself, this will create a self-connected layer.

Parameters:
next - The layer that is to be added.
type - The type of synapse to add.

addSynapse

void addSynapse(Synapse synapse)
This method adds a synapse to the neural network. Usually you will want to use the addNext method rather than directly adding synapses.

Parameters:
synapse - The synapse to add.

compute

NeuralData compute(NeuralData pattern)
Compute the output for this layer.

Parameters:
pattern - The input pattern.
Returns:
The output from this layer.

getActivationFunction

ActivationFunction getActivationFunction()
Returns:
The activation function used for this layer.

getID

int getID()
Returns:
The id for this layer.

getNetwork

BasicNetwork getNetwork()
Returns:
The network that this layer is attached to.

getNeuronCount

int getNeuronCount()
Returns:
The neuron count.

getNext

List<Synapse> getNext()
Get a list of all of the outbound synapse connections from this layer.

Returns:
The outbound connections.

getNextLayers

Collection<Layer> getNextLayers()
Returns:
The outbound layers from this layer.

getBiasWeights

double[] getBiasWeights()
Returns:
The weights between this layer an an optional preceding bias layer. Returns null, if there is no bias. See the Layer interface documentation for more information on how Encog handles bias values.

getBiasWeight

double getBiasWeight(int index)
Get an bias weight value. See the Layer interface documentation for more information on how Encog handles bias values.

Parameters:
index - The bias value to get.
Returns:
The bias value.

getX

int getX()
Returns:
The x-coordinate that this layer should be displayed at in a GUI.

getY

int getY()
Returns:
The y-coordinate that this layer should be displayed at in a GUI.

hasBias

boolean hasBias()
Returns:
True if this layer has a bias.

isConnectedTo

boolean isConnectedTo(Layer layer)
Determine if this layer is connected to another.

Parameters:
layer - The second layer, checked to see if it is connected to this layer.
Returns:
True if the two layers are connected.

process

void process(NeuralData pattern)
Process the data before it is modified by this layer. This method is useful for the context layer to remember the pattern it was presented with.

Parameters:
pattern - The pattern.

recur

NeuralData recur()
Called on recurrent layers to provide recurrent output. This is where the context layer will return the patter that it previously remembered.

Returns:
The recurrent output.

setActivationFunction

void setActivationFunction(ActivationFunction activationFunction)
Set a new activation function for this layer.

Parameters:
activationFunction - The new activation function.

setID

void setID(int id)
Set the id for this layer.

Parameters:
id - The id for this layer.

setNetwork

void setNetwork(BasicNetwork network)
Set the network that this layer belongs to.

Parameters:
network - The network.

setNeuronCount

void setNeuronCount(int neuronCount)
Set the neuron count, this will NOT adjust the synapses or bias weights other code must do that.

Parameters:
neuronCount - The new neuron count

setBiasWeights

void setBiasWeights(double[] d)
Set the bias weight array for this layer.

Parameters:
d - The new bias weight array.

setBiasWeight

void setBiasWeight(int index,
                   double d)
Set an individual bias weight value.

Parameters:
index - The index of the bias weight value.
d - The new bias weight value.

setX

void setX(int x)
Set the x coordinate. The x&y coordinates are used to display the level on a GUI.

Parameters:
x - The x-coordinate.

setY

void setY(int y)
Set the y coordinate. The x&y coordinates are used to display the level on a GUI.

Parameters:
y - The y-coordinate.

setBiasActivation

void setBiasActivation(double activation)
Most layer types will default this value to one. However, it is possible to use other values. This is the activation that will be passed over the bias weights to the inputs of this layer. See the Layer interface documentation for more information on how Encog handles bias values.

Parameters:
activation - The activation for the bias weights.

getBiasActivation

double getBiasActivation()
Most layer types will default this value to one. However, it is possible to use other values. This is the activation that will be passed over the bias weights to the inputs of this layer. See the Layer interface documentation for more information on how Encog handles bias values.

Returns:
The bias activation for this layer.


Copyright © 2011. All Rights Reserved.