org.neuroph.core
Class Layer

java.lang.Object
  extended by org.neuroph.core.Layer
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CompetitiveLayer

public class Layer
extends java.lang.Object
implements java.io.Serializable

 Layer of neurons in a neural network. The Layer is basic neuron container (a collection of neurons),
 and it provides methods for manipulating neurons (add, remove, get, set, calculate, randomize).
 

Author:
Zoran Sevarac
See Also:
Neuron, Serialized Form

Field Summary
protected  java.util.Vector<Neuron> neurons
          Neurons collection
 
Constructor Summary
Layer()
          Creates an instance of empty Layer
Layer(int neuronsNum, NeuronProperties neuronProperties)
          Creates an instance of Layer with the specified number of neurons with specified neuron properties
 
Method Summary
 void addNeuron(int idx, Neuron neuron)
          Adds specified neuron to this layer,at specified index position
 void addNeuron(Neuron neuron)
          Adds specified neuron to this layer
 void calculate()
          Performs calculaton for all neurons in this layer
 Neuron getNeuronAt(int idx)
          Returns neuron at specified index position in this layer
 java.util.Vector<Neuron> getNeurons()
          Returns collection of neurons in this layer
 int getNeuronsCount()
          Returns number of neurons in this layer
 java.util.Iterator<Neuron> getNeuronsIterator()
          Returns interface for iterating neurons in this layer
 NeuralNetwork getParentNetwork()
          Returns reference to parent network
 int indexOf(Neuron neuron)
          Returns the index position in layer for the specified neuron
 void randomizeWeights()
          Randomize input connection weights for all neurons in this layer
 void removeNeuron(Neuron neuron)
          Removes neuron from layer
 void removeNeuronAt(int idx)
          Removes neuron at specified index position in this layer
 void reset()
          Resets the activation and input levels for all neurons in this layer
 void setNeuron(int idx, Neuron neuron)
          Sets (replace) the neuron at specified position in layer
 void setParentNetwork(NeuralNetwork parent)
          Sets reference on parent network
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

neurons

protected java.util.Vector<Neuron> neurons
Neurons collection

Constructor Detail

Layer

public Layer()
Creates an instance of empty Layer


Layer

public Layer(int neuronsNum,
             NeuronProperties neuronProperties)
Creates an instance of Layer with the specified number of neurons with specified neuron properties

Method Detail

setParentNetwork

public void setParentNetwork(NeuralNetwork parent)
Sets reference on parent network

Parameters:
parent - parent network

getParentNetwork

public NeuralNetwork getParentNetwork()
Returns reference to parent network

Returns:
reference on parent neural network

getNeuronsIterator

public java.util.Iterator<Neuron> getNeuronsIterator()
Returns interface for iterating neurons in this layer

Returns:
interface for iterating neurons in this layer

getNeurons

public java.util.Vector<Neuron> getNeurons()
Returns collection of neurons in this layer

Returns:
collection of neurons in this layer

addNeuron

public void addNeuron(Neuron neuron)
Adds specified neuron to this layer

Parameters:
neuron - neuron to add

addNeuron

public void addNeuron(int idx,
                      Neuron neuron)
Adds specified neuron to this layer,at specified index position

Parameters:
neuron - neuron to add
idx - index position at which neuron should be added

setNeuron

public void setNeuron(int idx,
                      Neuron neuron)
Sets (replace) the neuron at specified position in layer

Parameters:
idx - index position to set/replace
neuron - new Neuron object to set

removeNeuron

public void removeNeuron(Neuron neuron)
Removes neuron from layer

Parameters:
neuron - neuron to remove

removeNeuronAt

public void removeNeuronAt(int idx)
Removes neuron at specified index position in this layer

Parameters:
idx - index position of neuron to remove

getNeuronAt

public Neuron getNeuronAt(int idx)
Returns neuron at specified index position in this layer

Parameters:
idx - neuron index position
Returns:
neuron at specified index position

indexOf

public int indexOf(Neuron neuron)
Returns the index position in layer for the specified neuron

Parameters:
neuron - neuron object
Returns:
index position of specified neuron

getNeuronsCount

public int getNeuronsCount()
Returns number of neurons in this layer

Returns:
number of neurons in this layer

calculate

public void calculate()
Performs calculaton for all neurons in this layer


reset

public void reset()
Resets the activation and input levels for all neurons in this layer


randomizeWeights

public void randomizeWeights()
Randomize input connection weights for all neurons in this layer