|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.joone.engine.Synapse
org.joone.engine.learning.AbstractTeacherSynapse
public abstract class AbstractTeacherSynapse
This class provides a framework to extend in order to implement various teachers, just by overriding or implementing certain functions different functionality can easily implemented.
Field Summary | |
---|---|
protected int |
currEpoch
|
protected StreamInputSynapse |
desired
The stream from where to read the desired input. |
protected Fifo |
error
Into this FIFO (first-in-first-out) object, the calculated error (e.g. |
protected boolean |
lastErrorPatternReady
True if an error pattern is available |
protected static ILogger |
log
Logger |
protected NeuralNet |
net
|
Fields inherited from class org.joone.engine.Synapse |
---|
array, b_pattern, bitems, bouts, count, enabled, fwdLock, inps, items, learnable, m_batch, m_pattern, myLearner, outs, revLock |
Constructor Summary | |
---|---|
AbstractTeacherSynapse()
Creates a new instance of AbstractTeacherSynapse |
|
AbstractTeacherSynapse(NeuralNet net)
|
Method Summary | |
---|---|
protected void |
backward(double[] pattern)
Funzione di TRAIN dell'elemento. |
abstract double |
calculateError(double aDesired,
double anOutput,
int anIndex)
Calculates the error to be backpropaged for a single output neuron. |
abstract double |
calculateGlobalError()
This method is called after an epoch finished and the global error should be calculated. |
java.util.TreeSet |
check()
Base for check messages. |
protected void |
constructErrorPattern(double[] aDesired,
double[] anOutput)
Constructs the error pattern that will be back-propagated. |
protected void |
epochFinished()
This method is called to signal that an epoch has finished. |
protected void |
forward(double[] pattern)
Recall function |
Pattern |
fwdGet()
Here, it forwards (returns) the pushed error (in FIFO order). |
void |
fwdPut(Pattern pattern)
Method to put a pattern forward to the next layer |
StreamInputSynapse |
getDesired()
Gets the stream to read the desired output. |
double[] |
getLastErrorPattern()
Return the most recently seen error pattern |
protected int |
getSeenPatterns()
Get the value of the number of patterns seen during the current epoch. |
protected void |
incSeenPatterns()
Increases the number of seen patterns by one. |
void |
init()
Synapse's initialization. |
protected boolean |
isFirstTime()
Checks whether it is the first time data is passed to this teacher or not. |
boolean |
isLastErrorPatternReady()
See if we have an error pattern available |
void |
netStoppedError()
|
protected void |
pushError(double error,
int count)
Pushes the calculated array in the FIFO queue at the end of a epoch, that is after all patterns have been seen. |
protected java.lang.Object |
readResolve()
|
void |
reset()
Reset the input and desired synapses |
void |
resetInput()
|
Pattern |
revGet()
Returns the error pattern coming from the next layer during the training phase |
void |
revPut(Pattern pattern)
Method to put an error pattern backward to the previous layer |
protected void |
setArrays(int rows,
int cols)
Insert the method's description here. |
boolean |
setDesired(StreamInputSynapse newDesired)
Set the input data stream containing desired training data. |
protected void |
setDimensions(int rows,
int cols)
Dimensiona l'elemento |
protected void |
setFirstTime(boolean aValue)
Sets the first time flag (is it the first time data is forwarded to this teacher). |
void |
setInputDimension(int newInputDimension)
Sets the input dimension of the synapse |
void |
setMonitor(Monitor newMonitor)
Sets the Monitor object of the Teacher Synapse. |
protected void |
setSeenPatterns(int aValue)
Set the value of the number of patterns seen during the current epoch. |
protected void |
stopTheNet()
|
Methods inherited from class org.joone.engine.Synapse |
---|
addNoise, canCountSteps, fwdPattern_consume, fwdPattern_produce, getCount, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getSynapseNameSafely, getWeights, initLearner, InspectableTitle, Inspections, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, revPattern_consume, revPattern_produce, setEnabled, setIgnoreBefore, setInputFull, setLearningRate, setLoopBack, setMomentum, setName, setOutputDimension, setOutputFull, setWeights, warnLogger, warnLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final ILogger log
protected StreamInputSynapse desired
protected transient Fifo error
protected transient int currEpoch
protected NeuralNet net
protected boolean lastErrorPatternReady
Constructor Detail |
---|
public AbstractTeacherSynapse(NeuralNet net)
public AbstractTeacherSynapse()
Method Detail |
---|
protected void setFirstTime(boolean aValue)
aValue
- value for the first time flag.protected boolean isFirstTime()
true
if it is the first time data is passed to this teacher,
false
otherwise.protected void backward(double[] pattern)
Synapse
backward
in class Synapse
pattern
- double[] - pattern di input sul quale applicare la funzione di trasferimentoprotected void pushError(double error, int count)
error,
- the calculated error.count,
- the cycle of the calculated error.protected void stopTheNet()
protected int getSeenPatterns()
protected void setSeenPatterns(int aValue)
aValue
- the new value for the number of patterns seen during the
current epoch.protected void incSeenPatterns()
public Pattern fwdGet()
fwdGet
in interface InputPatternListener
fwdGet
in class Synapse
public StreamInputSynapse getDesired()
public boolean setDesired(StreamInputSynapse newDesired)
newDesired
- the stream from where to read the desired output.protected java.lang.Object readResolve()
readResolve
in class Synapse
protected void setArrays(int rows, int cols)
Synapse
setArrays
in class Synapse
protected void setDimensions(int rows, int cols)
Synapse
setDimensions
in class Synapse
public void setInputDimension(int newInputDimension)
Synapse
setInputDimension
in interface OutputPatternListener
setInputDimension
in class Synapse
newInputDimension
- intpublic void reset()
reset
in interface InputPatternListener
reset
in class Synapse
public void resetInput()
public void setMonitor(Monitor newMonitor)
setMonitor
in interface NeuralElement
setMonitor
in class Synapse
newMonitor
- neural.engine.Monitorpublic void netStoppedError()
public void init()
Synapse
init
in interface NeuralElement
init
in class Synapse
public java.util.TreeSet check()
Synapse
check
in interface NeuralElement
check
in class Synapse
InputPaternListener
,
OutputPaternListener
public void revPut(Pattern pattern)
InputPatternListener
revPut
in interface InputPatternListener
revPut
in class Synapse
pattern
- neural.engine.Patternpublic Pattern revGet()
OutputPatternListener
revGet
in interface OutputPatternListener
revGet
in class Synapse
public void fwdPut(Pattern pattern)
OutputPatternListener
fwdPut
in interface OutputPatternListener
fwdPut
in class Synapse
pattern
- neural.engine.Patternprotected void forward(double[] pattern)
Synapse
forward
in class Synapse
pattern
- double[] - input pattern. THIS PATTERN CANNOT BE CHANGEDprotected void constructErrorPattern(double[] aDesired, double[] anOutput)
aDesired
- the desired patternanOutput
- the actual output patternpublic abstract double calculateError(double aDesired, double anOutput, int anIndex)
aDesired
- the desired outputanOutput
- the actual output of a single neuronanIndex
- the index of the output neuron
public abstract double calculateGlobalError()
protected void epochFinished()
super.epochFinished()
).
public double[] getLastErrorPattern()
public boolean isLastErrorPatternReady()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |