Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.joone.engine
Class KohonenSynapse  view KohonenSynapse download KohonenSynapse.java

java.lang.Object
  extended byorg.joone.engine.Synapse
      extended byorg.joone.engine.FullSynapse
          extended byorg.joone.engine.KohonenSynapse
All Implemented Interfaces:
java.util.EventListener, InputPatternListener, org.joone.inspection.Inspectable, Learnable, LearnableSynapse, NeuralElement, NeuralNetListener, OutputPatternListener, java.io.Serializable

public class KohonenSynapse
extends FullSynapse
implements NeuralNetListener

This is an unsupervised Kohonen Synapse which is a Self Organising Map.

This KohonenSynapse works in conjunction with the next layer which should implement a SOM strategy such as a GuassianLayer or WTALayer (Winner Takes All). This synapse should connect to one of these layers, without a SOM Strategy in the next layer this component will not function correctly.

This KohonenSynapse takes a pattern from the previous layer, calculates the distance between the input vector and the weights and passes this on to the next layer. In the learning phase the next layer should calculate the distance fall off between the winner and all other nodes (1.0 being the closest distance and 0.0 being furthest away and not being considered near to the winner). These distances are passed back to this KohonenSynapse and used to adjust the weights.

The weights are adjusted based on the current learning rate and distance fall off.

At each epoch/cycel the learning rate is adjusted in the following way ...

If the current cycle is within the ordering phase then the learning rate is set to

User setup learning rate * exp(-(double)(Current Cycle/Time Constant)).


Field Summary
(package private)  double currentLearningRate
           
private static org.joone.log.ILogger log
           
private  int orderingPhase
           
private static long serialVersionUID
           
private  double timeConstant
           
 
Fields inherited from class org.joone.engine.Synapse
array, b_pattern, bitems, bouts, count, enabled, fwdLock, inps, items, learnable, m_batch, m_pattern, myLearner, notFirstTime, notFirstTimeB, outs, revLock
 
Constructor Summary
KohonenSynapse()
          The default constructor for the KohonenSynapse class.
 
Method Summary
private  void adjustNodeWeight(int curnode, double learningRate, double distanceFalloff, double[] pattern)
          Adjusts the weights for the node located at x,y,z using the given distance and learning rate.
protected  void backward(double[] pattern)
          Adjusts the weights of this Kohonen Synapse according to the neighborhood fall off distance calculated by the next layer.
 java.util.TreeSet check()
          Check that there are no errors or problems with the properties of this KohonenSynapse.
 void cicleTerminated(NeuralNetEvent e)
          Changes the learning rate for this synapse depending in the current epoch number.
 void errorChanged(NeuralNetEvent e)
          Not implemented.
protected  void forward(double[] pattern)
          Fowards the euclidean distance squared between the input vector and the weight vector to the next layer.
 Learner getLearner()
          Returns the appropriate Learner object for this class depending on the Monitor.learningMode property value
 int getOrderingPhase()
          Getter for property orderingPhase.
 double getTimeConstant()
          Getter for property timeConstant.
 void netStarted(NeuralNetEvent e)
          Initialises any shape sizes such as circular radius and time constant before possible training.
 void netStopped(NeuralNetEvent e)
          Not implemented.
 void netStoppedError(NeuralNetEvent e, java.lang.String error)
          Not implemented.
private  void readObject(java.io.ObjectInputStream in)
           
 void setMonitor(Monitor newMonitor)
          Sets the Monitor object of the synapse
 void setOrderingPhase(int orderingPhase)
          Setter for property orderingPhase.
 void setTimeConstant(double timeConstant)
          Setter for property timeConstant.
 
Methods inherited from class org.joone.engine.FullSynapse
setArrays, setDimensions
 
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdGet, fwdPut, getFwdLock, getIgnoreBefore, getInputDimension, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getWeights, init, initLearner, InspectableTitle, Inspections, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, reset, revGet, revPut, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setName, setOutputDimension, setOutputFull, setWeights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.joone.engine.LearnableSynapse
getInputDimension, getLearningRate, getMomentum, getOutputDimension, getWeights, setWeights
 
Methods inherited from interface org.joone.engine.Learnable
getMonitor, initLearner
 

Field Detail

log

private static final org.joone.log.ILogger log

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

currentLearningRate

double currentLearningRate

timeConstant

private double timeConstant

orderingPhase

private int orderingPhase
Constructor Detail

KohonenSynapse

public KohonenSynapse()

The default constructor for the KohonenSynapse class.

Method Detail

backward

protected void backward(double[] pattern)

Adjusts the weights of this Kohonen Synapse according to the neighborhood fall off distance calculated by the next layer.

Overrides:
backward in class FullSynapse

forward

protected void forward(double[] pattern)

Fowards the euclidean distance squared between the input vector and the weight vector to the next layer. If the learning phase is currently active then the next layer should process this and pass back the distance fall off between the winning output and all other outputs.

Overrides:
forward in class FullSynapse

adjustNodeWeight

private void adjustNodeWeight(int curnode,
                              double learningRate,
                              double distanceFalloff,
                              double[] pattern)
Adjusts the weights for the node located at x,y,z using the given distance and learning rate.


setMonitor

public void setMonitor(Monitor newMonitor)
Sets the Monitor object of the synapse

Specified by:
setMonitor in interface NeuralElement
Overrides:
setMonitor in class Synapse

cicleTerminated

public void cicleTerminated(NeuralNetEvent e)

Changes the learning rate for this synapse depending in the current epoch number. The learning rate is changed in the following way ...

User setup learning rate * exp(-(double)(Current Cycle/Time Constant)).

Specified by:
cicleTerminated in interface NeuralNetListener

errorChanged

public void errorChanged(NeuralNetEvent e)
Not implemented.

Specified by:
errorChanged in interface NeuralNetListener

netStarted

public void netStarted(NeuralNetEvent e)
Initialises any shape sizes such as circular radius and time constant before possible training.

Specified by:
netStarted in interface NeuralNetListener

netStopped

public void netStopped(NeuralNetEvent e)
Not implemented.

Specified by:
netStopped in interface NeuralNetListener

netStoppedError

public void netStoppedError(NeuralNetEvent e,
                            java.lang.String error)
Not implemented.

Specified by:
netStoppedError in interface NeuralNetListener

check

public java.util.TreeSet check()

Check that there are no errors or problems with the properties of this KohonenSynapse.

Specified by:
check in interface NeuralElement
Overrides:
check in class Synapse

getOrderingPhase

public int getOrderingPhase()
Getter for property orderingPhase.


setOrderingPhase

public void setOrderingPhase(int orderingPhase)
Setter for property orderingPhase.


getTimeConstant

public double getTimeConstant()
Getter for property timeConstant.


setTimeConstant

public void setTimeConstant(double timeConstant)
Setter for property timeConstant.


getLearner

public Learner getLearner()
Deprecated. - Used only for backward compatibility

Description copied from class: Synapse
Returns the appropriate Learner object for this class depending on the Monitor.learningMode property value

Specified by:
getLearner in interface Learnable
Overrides:
getLearner in class FullSynapse

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException