public abstract class Synapse extends java.lang.Object implements InputPatternListener, OutputPatternListener, LearnableSynapse, java.io.Serializable, Inspectable
| Modifier and Type | Field and Description |
|---|---|
protected Matrix |
array |
protected Pattern |
b_pattern |
protected int |
bitems |
protected double[] |
bouts |
protected int |
count |
protected boolean |
enabled |
protected java.lang.Object |
fwdLock |
protected double[] |
inps |
protected int |
items |
protected boolean |
learnable
Contains true if for the current Synapse must be used
a Learner instead of a built-in learning algorithm.
|
protected int |
m_batch |
protected Pattern |
m_pattern |
protected Learner |
myLearner |
protected double[] |
outs |
protected java.lang.Object |
revLock |
| Constructor and Description |
|---|
Synapse()
The constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNoise(double amplitude)
Adds a uniformly distributed noise to the weights of the synapse
|
protected abstract void |
backward(double[] pattern)
Funzione di TRAIN dell'elemento.
|
boolean |
canCountSteps()
Returns TRUE if the synapse calls the method nextStep()
on the Monitor object when the fwdGet() method is called
|
java.util.TreeSet |
check()
Base for check messages.
|
protected abstract void |
forward(double[] pattern)
Recall function
|
Pattern |
fwdGet()
Returns the pattern coming from the previous layer during the recall phase
|
protected void |
fwdPattern_consume(Pattern pattern) |
protected Pattern |
fwdPattern_produce() |
void |
fwdPut(Pattern pattern)
Method to put a pattern forward to the next layer
|
int |
getCount()
Return the current pattern count
|
protected java.lang.Object |
getFwdLock()
Getter for property fwdLock.
|
int |
getIgnoreBefore()
Returns the number of the ignored cycles at beginning of each epoch.
|
int |
getInputDimension()
Returns the input dimension of the synapse.
|
Learner |
getLearner()
Returns the appropriate Learner object for this class
depending on the Monitor.learningMode property value
|
double |
getLearningRate()
Returns the value of the learning rate
|
double |
getMomentum()
Returns the value of the momentum
|
Monitor |
getMonitor()
Returns the Monitor object attached to the synapse
|
java.lang.String |
getName()
Returns the name of the synapse
|
int |
getOutputDimension()
Returns the output dimension of the synapse.
|
protected java.lang.Object |
getRevLock()
Getter for property revLock.
|
protected java.lang.String |
getSynapseNameSafely() |
Matrix |
getWeights()
Getter for the internal matrix of weights
|
void |
init()
Synapse's initialization.
|
void |
initLearner()
Initialize the Learner object
|
java.lang.String |
InspectableTitle()
Method to get the title to show
in the InspectionFrame tab.
|
java.util.Collection |
Inspections()
Method to get a collection of inspectable objects.
|
boolean |
isEnabled()
Getter for property enabled.
|
boolean |
isInputFull()
Getter for property inputFull.
|
boolean |
isLoopBack()
Getter for property loopBack.
|
boolean |
isOutputFull()
Getter for property outputFull.
|
void |
randomize(double amplitude)
Initializes all the weigths of the synapses with random values If
RandomWeightInitializer is set (default situation) weights are
initialized with uniformly distributed random values.
|
protected java.lang.Object |
readResolve() |
void |
reset()
Resets the internal state to be ready for the next run
|
Pattern |
revGet()
Returns the error pattern coming from the next layer during the training phase
|
protected Pattern |
revPattern_consume() |
protected void |
revPattern_produce(Pattern pattern) |
void |
revPut(Pattern pattern)
Method to put an error pattern backward to the previous layer
|
protected abstract void |
setArrays(int rows,
int cols)
Insert the method's description here.
|
protected abstract void |
setDimensions(int rows,
int cols)
Dimensiona l'elemento
|
void |
setEnabled(boolean enabled)
Setter for property enabled.
|
void |
setIgnoreBefore(int newIgnoreBefore)
Sets the number of the ignored cycles at beginning of each epoch.
|
void |
setInputDimension(int newInputDimension)
Sets the input dimension of the synapse
|
void |
setInputFull(boolean inputFull)
Setter for property inputFull.
|
void |
setLearningRate(double newLearningRate)
Deprecated.
|
void |
setLoopBack(boolean loopBack)
Setter for property loopBack.
|
void |
setMomentum(double newMomentum)
Deprecated.
|
void |
setMonitor(Monitor newMonitor)
Sets the Monitor object of the synapse
|
void |
setName(java.lang.String name)
Sets the name of the synapse
|
void |
setOutputDimension(int newOutputDimension)
Sets the output dimension of the synapse
|
void |
setOutputFull(boolean outputFull)
Setter for property outputFull.
|
void |
setWeights(Matrix newWeights)
Setter for the internal matrix of weights
|
protected void |
warnLogger(java.lang.String msg,
java.lang.Exception ex,
ILogger logger) |
protected void |
warnLogger(java.lang.String msg,
ILogger logger) |
protected Matrix array
protected int m_batch
protected boolean enabled
protected transient double[] inps
protected transient double[] outs
protected transient double[] bouts
protected transient int items
protected transient int bitems
protected transient Pattern m_pattern
protected transient Pattern b_pattern
protected transient int count
protected transient Learner myLearner
protected transient volatile java.lang.Object fwdLock
protected transient volatile java.lang.Object revLock
protected boolean learnable
getLearnerpublic void addNoise(double amplitude)
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.2public void randomize(double amplitude)
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.2protected abstract void backward(double[] pattern)
pattern - double[] - pattern di input sul quale applicare la funzione di trasferimentopublic boolean canCountSteps()
protected abstract void forward(double[] pattern)
pattern - double[] - input pattern. THIS PATTERN CANNOT BE CHANGEDpublic Pattern fwdGet()
InputPatternListenerfwdGet in interface InputPatternListenerprotected Pattern fwdPattern_produce()
public void fwdPut(Pattern pattern)
OutputPatternListenerfwdPut in interface OutputPatternListenerpattern - neural.engine.Patternprotected void fwdPattern_consume(Pattern pattern)
pattern - public void reset()
reset in interface InputPatternListenerpublic int getIgnoreBefore()
setIgnoreBefore(int)public int getInputDimension()
getInputDimension in interface LearnableSynapsegetInputDimension in interface OutputPatternListenerpublic double getLearningRate()
getLearningRate in interface LearnableSynapsepublic double getMomentum()
getMomentum in interface LearnableSynapsepublic Monitor getMonitor()
getMonitor in interface LearnablegetMonitor in interface NeuralElementpublic java.lang.String getName()
getName in interface NeuralElementsetName(java.lang.String)public int getOutputDimension()
getOutputDimension in interface InputPatternListenergetOutputDimension in interface LearnableSynapseprotected java.lang.Object readResolve()
public Pattern revGet()
OutputPatternListenerrevGet in interface OutputPatternListenerprotected Pattern revPattern_consume()
public void revPut(Pattern pattern)
InputPatternListenerrevPut in interface InputPatternListenerpattern - neural.engine.Patternprotected void revPattern_produce(Pattern pattern)
pattern - protected abstract void setArrays(int rows,
int cols)
protected abstract void setDimensions(int rows,
int cols)
int - rows - righeint - cols - colonnepublic void setIgnoreBefore(int newIgnoreBefore)
newIgnoreBefore - intSwitchSynapsepublic void setInputDimension(int newInputDimension)
setInputDimension in interface OutputPatternListenernewInputDimension - intpublic void setLearningRate(double newLearningRate)
newLearningRate - doublepublic void setMomentum(double newMomentum)
newMomentum - doublepublic void setMonitor(Monitor newMonitor)
setMonitor in interface NeuralElementnewMonitor - neural.engine.Monitorpublic void setName(java.lang.String name)
setName in interface NeuralElementname - The name of the component.getName()public void setOutputDimension(int newOutputDimension)
setOutputDimension in interface InputPatternListenernewOutputDimension - intpublic boolean isEnabled()
isEnabled in interface NeuralElementpublic void setEnabled(boolean enabled)
setEnabled in interface NeuralElementenabled - New value of property enabled.public boolean isLoopBack()
public void setLoopBack(boolean loopBack)
loopBack - New value of property loopBack.public java.util.TreeSet check()
check in interface NeuralElementInputPaternListener,
OutputPaternListenerpublic java.util.Collection Inspections()
InspectableInspections in interface Inspectableorg.joone.Inspectionpublic java.lang.String InspectableTitle()
InspectableInspectableTitle in interface Inspectableorg.joone.InspectionFramepublic boolean isInputFull()
isInputFull in interface InputPatternListenerpublic void setInputFull(boolean inputFull)
setInputFull in interface InputPatternListenerinputFull - New value of property inputFull.public boolean isOutputFull()
isOutputFull in interface OutputPatternListenerpublic void setOutputFull(boolean outputFull)
setOutputFull in interface OutputPatternListeneroutputFull - New value of property outputFull.public Matrix getWeights()
getWeights in interface LearnableSynapsepublic void setWeights(Matrix newWeights)
setWeights in interface LearnableSynapsethe - Matrix containing the 2D array of weightspublic Learner getLearner()
getLearner in interface LearnableLearnable.getLearner()public void initLearner()
initLearner in interface LearnableLearnable.initLearner()protected final java.lang.Object getFwdLock()
protected final java.lang.Object getRevLock()
public void init()
init in interface NeuralElementprotected java.lang.String getSynapseNameSafely()
protected void warnLogger(java.lang.String msg,
ILogger logger)
protected void warnLogger(java.lang.String msg,
java.lang.Exception ex,
ILogger logger)
public int getCount()
Submit Feedback to pmarrone@users.sourceforge.net