org.joone.engine
Class Synapse
- java.lang.Object
-
- org.joone.engine.Synapse
-
- All Implemented Interfaces:
- java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable
- Direct Known Subclasses:
- AbstractTeacherSynapse, BufferedSynapse, ComparisonSynapse, DelaySynapse, DirectSynapse, FullSynapse, RbfInputSynapse, StreamInputSynapse, StreamOutputSynapse
public abstract class Synapse extends java.lang.Object implements InputPatternListener, OutputPatternListener, LearnableSynapse, java.io.Serializable, Inspectable
The Synapse is the connection element between two Layer objects. Its connections are represented by weights that transport the patterns from a layer to another. These weights are modified in the learning cycles, and represent the 'memory' of the trained neural net.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Synapse()The constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddNoise(double amplitude)Adds a noise to the weights of the synapsebooleancanCountSteps()Returns TRUE if the synapse calls the method nextStep() on the Monitor object when the fwdGet() method is calledjava.util.TreeSetcheck()Base for check messages.PatternfwdGet()Returns the pattern coming from the previous layer during the recall phasevoidfwdPut(Pattern pattern)Method to put a pattern forward to the next layerintgetIgnoreBefore()Returns the number of the ignored cycles at beginning of each epoch.intgetInputDimension()Returns the input dimension of the synapse.LearnergetLearner()Returns the appropriate Learner object for this class depending on the Monitor.learningMode property valuedoublegetLearningRate()Returns the value of the learning ratedoublegetMomentum()Returns the value of the momentumMonitorgetMonitor()Returns the Monitor object attached to the synapsejava.lang.StringgetName()Returns the name of the synapseintgetOutputDimension()Returns the output dimension of the synapse.MatrixgetWeights()Getter for the internal matrix of weightsvoidinit()Synapse's initialization.voidinitLearner()Initialize the Learner objectjava.lang.StringInspectableTitle()Method to get the title to show in the InspectionFrame tab.java.util.CollectionInspections()Method to get a collection of inspectable objects.booleanisEnabled()Getter for property enabled.booleanisInputFull()Getter for property inputFull.booleanisLoopBack()Getter for property loopBack.booleanisOutputFull()Getter for property outputFull.voidrandomize(double amplitude)Initializes all the weigths of the synapses with random valuesvoidreset()Resets the internal state to be ready for the next runPatternrevGet()Returns the error pattern coming from the next layer during the training phasevoidrevPut(Pattern pattern)Method to put an error pattern backward to the previous layervoidsetEnabled(boolean enabled)Setter for property enabled.voidsetIgnoreBefore(int newIgnoreBefore)Sets the number of the ignored cycles at beginning of each epoch.voidsetInputDimension(int newInputDimension)Sets the input dimension of the synapsevoidsetInputFull(boolean inputFull)Setter for property inputFull.voidsetLearningRate(double newLearningRate)Sets the value of the learning ratevoidsetLoopBack(boolean loopBack)Setter for property loopBack.voidsetMomentum(double newMomentum)Sets the value of the momentum ratevoidsetMonitor(Monitor newMonitor)Sets the Monitor object of the synapsevoidsetName(java.lang.String name)Sets the name of the synapsevoidsetOutputDimension(int newOutputDimension)Sets the output dimension of the synapsevoidsetOutputFull(boolean outputFull)Setter for property outputFull.voidsetWeights(Matrix newWeights)Setter for the internal matrix of weights
-
-
-
Method Detail
-
addNoise
public void addNoise(double amplitude)
Adds a noise to the weights of the synapse- Parameters:
amplitude- Amplitude of the noise: the value is centered around the zero. e.g.: an amplitude = 0.2 means a noise range from -0.2 to 0.2
-
randomize
public void randomize(double amplitude)
Initializes all the weigths of the synapses with random values- Parameters:
amplitude- Amplitude of the random values: the value is centered around the zero. e.g.: an amplitude = 0.2 means a values' range from -0.2 to 0.2
-
canCountSteps
public boolean canCountSteps()
Returns TRUE if the synapse calls the method nextStep() on the Monitor object when the fwdGet() method is called- Returns:
- boolean
-
fwdGet
public Pattern fwdGet()
Description copied from interface:InputPatternListenerReturns the pattern coming from the previous layer during the recall phase- Specified by:
fwdGetin interfaceInputPatternListener- Returns:
- neural.engine.Pattern
-
fwdPut
public void fwdPut(Pattern pattern)
Description copied from interface:OutputPatternListenerMethod to put a pattern forward to the next layer- Specified by:
fwdPutin interfaceOutputPatternListener- Parameters:
pattern- neural.engine.Pattern
-
reset
public void reset()
Resets the internal state to be ready for the next run- Specified by:
resetin interfaceInputPatternListener
-
getIgnoreBefore
public int getIgnoreBefore()
Returns the number of the ignored cycles at beginning of each epoch. During these cycles the synapse returns null on the call to the xxxGet methods- Returns:
- int
- See Also:
setIgnoreBefore(int)
-
getInputDimension
public int getInputDimension()
Returns the input dimension of the synapse.- Specified by:
getInputDimensionin interfaceLearnableSynapse- Specified by:
getInputDimensionin interfaceOutputPatternListener- Returns:
- int
-
getLearningRate
public double getLearningRate()
Returns the value of the learning rate- Specified by:
getLearningRatein interfaceLearnableSynapse- Returns:
- double
-
getMomentum
public double getMomentum()
Returns the value of the momentum- Specified by:
getMomentumin interfaceLearnableSynapse- Returns:
- double
-
getMonitor
public Monitor getMonitor()
Returns the Monitor object attached to the synapse- Specified by:
getMonitorin interfaceLearnable- Specified by:
getMonitorin interfaceNeuralElement- Returns:
- neural.engine.Monitor
-
getName
public java.lang.String getName()
Returns the name of the synapse- Specified by:
getNamein interfaceNeuralElement- Returns:
- String
- See Also:
setName(java.lang.String)
-
getOutputDimension
public int getOutputDimension()
Returns the output dimension of the synapse.- Specified by:
getOutputDimensionin interfaceInputPatternListener- Specified by:
getOutputDimensionin interfaceLearnableSynapse- Returns:
- int
-
revGet
public Pattern revGet()
Description copied from interface:OutputPatternListenerReturns the error pattern coming from the next layer during the training phase- Specified by:
revGetin interfaceOutputPatternListener- Returns:
- neural.engine.Pattern
-
revPut
public void revPut(Pattern pattern)
Description copied from interface:InputPatternListenerMethod to put an error pattern backward to the previous layer- Specified by:
revPutin interfaceInputPatternListener- Parameters:
pattern- neural.engine.Pattern
-
setIgnoreBefore
public void setIgnoreBefore(int newIgnoreBefore)
Sets the number of the ignored cycles at beginning of each epoch. During these cycles the synapse is disabled. Useful when the synapse is attached as the Input2 of a SwitchSynapse- Parameters:
newIgnoreBefore- int- See Also:
SwitchSynapse
-
setInputDimension
public void setInputDimension(int newInputDimension)
Sets the input dimension of the synapse- Specified by:
setInputDimensionin interfaceOutputPatternListener- Parameters:
newInputDimension- int
-
setLearningRate
public void setLearningRate(double newLearningRate)
Sets the value of the learning rate- Parameters:
newLearningRate- double
-
setMomentum
public void setMomentum(double newMomentum)
Sets the value of the momentum rate- Parameters:
newMomentum- double
-
setMonitor
public void setMonitor(Monitor newMonitor)
Sets the Monitor object of the synapse- Specified by:
setMonitorin interfaceNeuralElement- Parameters:
newMonitor- neural.engine.Monitor
-
setName
public void setName(java.lang.String name)
Sets the name of the synapse- Specified by:
setNamein interfaceNeuralElement- Parameters:
name- The name of the component.- See Also:
getName()
-
setOutputDimension
public void setOutputDimension(int newOutputDimension)
Sets the output dimension of the synapse- Specified by:
setOutputDimensionin interfaceInputPatternListener- Parameters:
newOutputDimension- int
-
isEnabled
public boolean isEnabled()
Getter for property enabled.- Specified by:
isEnabledin interfaceNeuralElement- Returns:
- Value of property enabled.
-
setEnabled
public void setEnabled(boolean enabled)
Setter for property enabled.- Specified by:
setEnabledin interfaceNeuralElement- Parameters:
enabled- New value of property enabled.
-
isLoopBack
public boolean isLoopBack()
Getter for property loopBack.- Returns:
- Value of property loopBack.
-
setLoopBack
public void setLoopBack(boolean loopBack)
Setter for property loopBack.- Parameters:
loopBack- New value of property loopBack.
-
check
public java.util.TreeSet check()
Base for check messages. Subclasses should call this method from thier own check method.- Specified by:
checkin interfaceNeuralElement- Returns:
- validation errors.
- See Also:
InputPaternListener,OutputPaternListener
-
Inspections
public java.util.Collection Inspections()
Description copied from interface:InspectableMethod to get a collection of inspectable objects.- Specified by:
Inspectionsin interfaceInspectable- Returns:
- list of Inspectable objects
- See Also:
org.joone.Inspection
-
InspectableTitle
public java.lang.String InspectableTitle()
Description copied from interface:InspectableMethod to get the title to show in the InspectionFrame tab.- Specified by:
InspectableTitlein interfaceInspectable- Returns:
- title of the class.
- See Also:
org.joone.InspectionFrame
-
isInputFull
public boolean isInputFull()
Getter for property inputFull.- Specified by:
isInputFullin interfaceInputPatternListener- Returns:
- Value of property inputFull.
-
setInputFull
public void setInputFull(boolean inputFull)
Setter for property inputFull.- Specified by:
setInputFullin interfaceInputPatternListener- Parameters:
inputFull- New value of property inputFull.
-
isOutputFull
public boolean isOutputFull()
Getter for property outputFull.- Specified by:
isOutputFullin interfaceOutputPatternListener- Returns:
- Value of property outputFull.
-
setOutputFull
public void setOutputFull(boolean outputFull)
Setter for property outputFull.- Specified by:
setOutputFullin interfaceOutputPatternListener- Parameters:
outputFull- New value of property outputFull.
-
getWeights
public Matrix getWeights()
Getter for the internal matrix of weights- Specified by:
getWeightsin interfaceLearnableSynapse- Returns:
- the Matrix containing the 2D array of weights
-
setWeights
public void setWeights(Matrix newWeights)
Setter for the internal matrix of weights- Specified by:
setWeightsin interfaceLearnableSynapse- Parameters:
the- Matrix containing the 2D array of weights
-
getLearner
public Learner getLearner()
Returns the appropriate Learner object for this class depending on the Monitor.learningMode property value- Specified by:
getLearnerin interfaceLearnable- Returns:
- the Learner object if applicable, otherwise null
- See Also:
Learnable.getLearner()
-
initLearner
public void initLearner()
Initialize the Learner object- Specified by:
initLearnerin interfaceLearnable- See Also:
Learnable.initLearner()
-
init
public void init()
Synapse's initialization. It needs to be invoked at the starting of the neural network It's called within the Layer.init() method- Specified by:
initin interfaceNeuralElement
-
-
DataMelt 3.0 © DataMelt by jWork.ORG