org.joone.io
Class InputSwitchSynapse

java.lang.Object
  extended by org.joone.engine.Synapse
      extended by org.joone.io.StreamInputSynapse
          extended by org.joone.io.InputSwitchSynapse
All Implemented Interfaces:
java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable, InputSynapse, PlugInListener
Direct Known Subclasses:
LearningSwitch, MultipleInputSynapse

public class InputSwitchSynapse
extends StreamInputSynapse
implements java.io.Serializable

This class acts as a switch that can connect its output to one of its connected input synapses. Many input synapses can be attached to the switch calling the method addInputSynapse, but only one is attached to the output; which one is comnnected is determined by the call to the method setActiveInput, passing to it the name of the selected synapse.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector inputs
           
 
Fields inherited from class org.joone.io.StreamInputSynapse
cols, currentRow, EOF, InputVector, plugInListeners, tokens
 
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
InputSwitchSynapse()
          The constructor
 
Method Summary
 boolean addInputSynapse(StreamInputSynapse newInput)
          Adds an input synapse to the switch
protected  void backward(double[] pattern)
          Funzione di TRAIN dell'elemento.
 java.util.TreeSet check()
          Check that parameters are set correctly.
 void dataChanged(PlugInEvent data)
          This method is called by plug-ins whenever data is changed.
protected  void forward(double[] pattern)
          Recall function
 Pattern fwdGet()
          Returns the pattern coming from the previous layer during the recall phase
 Pattern fwdGet(InputConnector conn)
          Returns the pattern coming from the previous layer during the recall phase.
 java.lang.String getActiveInput()
          Returns the name of the actual connected input synapse
protected  StreamInputSynapse getActiveSynapse()
          Getter for property activeSynapse.
 java.lang.String getAdvancedColumnSelector()
           
 java.util.Vector getAllInputs()
           
 java.lang.String getDefaultInput()
          Returns the name of the default input synapse that is connected when the reset method is called
protected  StreamInputSynapse getDefaultSynapse()
          Getter for property defaultSynapse.
 int getFirstRow()
           
protected  StreamInputSynapse getInputSynapse(java.lang.String inputName)
           
 java.util.Collection getInspections()
           
 int getLastRow()
           
 Monitor getMonitor()
          Returns the monitor
 java.lang.String getName()
          Returns the name of the input synapse
 int getOutputDimension()
          Returns the dimension of the input synapse
 ConverterPlugIn getPlugIn()
          Gets the attached ConverterPlugin, if any
 void gotoFirstLine()
           
 void gotoLine(int numLine)
          Point to the indicated line into the input stream
 void init()
          Synapse's initialization.
protected  void initInputStream()
           
 boolean isBuffered()
          Returns if the input synapse is buffered (10/04/00 23.11.30)
 boolean isEOF()
          Returns if reached the EOF (10/04/00 23.16.20)
 boolean isStepCounter()
          Returns if this input layer is an active counter of the steps.
 int numColumns()
           
 void readAll()
          Reads all input values and fills the buffer
 void removeAllInputs()
           
 boolean removeInputSynapse(java.lang.String inputName)
          Removes an input synapse from the switch
 void reset()
          reset the state of the input synapse
 void resetInput()
          Reset the input stream to read its content again
 void resetSwitch()
          Resets the switch, connecting the default synapse to the output
 void revPut(Pattern pattern)
          Method to put an error pattern backward to the previous layer
 void setActiveInput(java.lang.String newActiveInput)
          Sets the input synapse connected to the output
protected  void setActiveSynapse(StreamInputSynapse activeSynapse)
          Setter for property activeSynapse.
 void setAllInputs(java.util.Vector inps)
           
 void setBuffered(boolean newBuffered)
          Sets the buffer-mode for this input synapse.
 void setDecimalPoint(char dp)
           
 void setDefaultInput(java.lang.String newDefaultInput)
          Sets the name of the default input synapse that is connected when the reset method is called
protected  void setDefaultSynapse(StreamInputSynapse defaultSynapse)
          Setter for property defaultSynapse.
 void setMonitor(Monitor newMonitor)
          Sets the Monitor object of the input synapse
 void setName(java.lang.String name)
          Sets the name of the input synapse
 void setOutputDimension(int newOutputDimension)
          Sets the dimension of the input synapse
 void setStepCounter(boolean newStepCounter)
          Inserire qui la descrizione del metodo.
 
Methods inherited from class org.joone.io.StreamInputSynapse
addPlugIn, addPlugInListener, fireDataChanged, getAllPlugInListeners, getCurrentRow, getDecimalPoint, getFirstCol, getInputPatterns, getInputVector, getLastCol, getMaxBufSize, getStream, getTokens, handleExceptionWithError, handleExceptionWithWarn, InspectableTitle, Inspections, readObjectBase, removeAllPlugIns, removePlugInListener, restart, setAdvancedColumnSelector, setArrays, setColList, setDimensions, setEOF, setFirstCol, setFirstRow, setInputPatterns, setLastCol, setLastRow, setMaxBufSize, setPlugin, setPlugIn, setTokens, writeObjectBase, zeroPattern
 
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdPattern_consume, fwdPattern_produce, fwdPut, getCount, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getRevLock, getSynapseNameSafely, getWeights, initLearner, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, revGet, revPattern_consume, revPattern_produce, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setOutputFull, setWeights, warnLogger, warnLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputs

protected java.util.Vector inputs
Constructor Detail

InputSwitchSynapse

public InputSwitchSynapse()
The constructor

Method Detail

init

public void init()
Description copied from class: Synapse
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:
init in interface NeuralElement
Overrides:
init in class Synapse

resetSwitch

public void resetSwitch()
Resets the switch, connecting the default synapse to the output


reset

public void reset()
Description copied from class: StreamInputSynapse
reset the state of the input synapse

Specified by:
reset in interface InputPatternListener
Overrides:
reset in class StreamInputSynapse

removeInputSynapse

public boolean removeInputSynapse(java.lang.String inputName)
Removes an input synapse from the switch

Parameters:
inputName - The name of the synapse to remove
Returns:
false if the synapse cannot be found

getInputSynapse

protected StreamInputSynapse getInputSynapse(java.lang.String inputName)

addInputSynapse

public boolean addInputSynapse(StreamInputSynapse newInput)
Adds an input synapse to the switch

Parameters:
newInput - the new input synapse

getActiveInput

public java.lang.String getActiveInput()
Returns the name of the actual connected input synapse

Returns:
The name of the connected input synapse

setActiveInput

public void setActiveInput(java.lang.String newActiveInput)
Sets the input synapse connected to the output

Parameters:
newActiveInput - the name of the input synapse to connect

getDefaultInput

public java.lang.String getDefaultInput()
Returns the name of the default input synapse that is connected when the reset method is called

Returns:
the name of the default synapse

setDefaultInput

public void setDefaultInput(java.lang.String newDefaultInput)
Sets the name of the default input synapse that is connected when the reset method is called

Parameters:
newDefaultInput - the name of the default input synapse

getActiveSynapse

protected StreamInputSynapse getActiveSynapse()
Getter for property activeSynapse.

Returns:
Value of property activeSynapse.

setActiveSynapse

protected void setActiveSynapse(StreamInputSynapse activeSynapse)
Setter for property activeSynapse.

Parameters:
activeSynapse - New value of property activeSynapse.

getDefaultSynapse

protected StreamInputSynapse getDefaultSynapse()
Getter for property defaultSynapse.

Returns:
Value of property defaultSynapse.

setDefaultSynapse

protected void setDefaultSynapse(StreamInputSynapse defaultSynapse)
Setter for property defaultSynapse.

Parameters:
defaultSynapse - New value of property defaultSynapse.

getName

public java.lang.String getName()
Returns the name of the input synapse

Specified by:
getName in interface NeuralElement
Overrides:
getName in class Synapse
Returns:
<{String}>
See Also:
Synapse.setName(java.lang.String)

setName

public void setName(java.lang.String name)
Sets the name of the input synapse

Specified by:
setName in interface NeuralElement
Overrides:
setName in class Synapse
Parameters:
name - String
See Also:
Synapse.getName()

setOutputDimension

public void setOutputDimension(int newOutputDimension)
Sets the dimension of the input synapse

Specified by:
setOutputDimension in interface InputPatternListener
Overrides:
setOutputDimension in class Synapse
Parameters:
newOutputDimension - int

revPut

public void revPut(Pattern pattern)
Method to put an error pattern backward to the previous layer

Specified by:
revPut in interface InputPatternListener
Overrides:
revPut in class StreamInputSynapse
Parameters:
pattern - neural.engine.Pattern

fwdGet

public Pattern fwdGet()
Returns the pattern coming from the previous layer during the recall phase

Specified by:
fwdGet in interface InputPatternListener
Overrides:
fwdGet in class StreamInputSynapse
Returns:
neural.engine.Pattern

fwdGet

public Pattern fwdGet(InputConnector conn)
Returns the pattern coming from the previous layer during the recall phase. This method is called by the InputConnector class

Overrides:
fwdGet in class StreamInputSynapse
Returns:
neural.engine.Pattern

getOutputDimension

public int getOutputDimension()
Returns the dimension of the input synapse

Specified by:
getOutputDimension in interface InputPatternListener
Specified by:
getOutputDimension in interface LearnableSynapse
Overrides:
getOutputDimension in class Synapse
Returns:
int

getMonitor

public Monitor getMonitor()
Returns the monitor

Specified by:
getMonitor in interface Learnable
Specified by:
getMonitor in interface NeuralElement
Overrides:
getMonitor in class Synapse
Returns:
<{Monitor}>

setMonitor

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

Specified by:
setMonitor in interface NeuralElement
Overrides:
setMonitor in class Synapse
Parameters:
newMonitor - org.joone.engine.Monitor

backward

protected void backward(double[] pattern)
Description copied from class: Synapse
Funzione di TRAIN dell'elemento.

Overrides:
backward in class StreamInputSynapse
Parameters:
pattern - double[] - pattern di input sul quale applicare la funzione di trasferimento

forward

protected void forward(double[] pattern)
Description copied from class: Synapse
Recall function

Overrides:
forward in class StreamInputSynapse
Parameters:
pattern - double[] - input pattern. THIS PATTERN CANNOT BE CHANGED

getAllInputs

public java.util.Vector getAllInputs()

setAllInputs

public void setAllInputs(java.util.Vector inps)

resetInput

public void resetInput()
Description copied from class: StreamInputSynapse
Reset the input stream to read its content again

Specified by:
resetInput in interface InputSynapse
Overrides:
resetInput in class StreamInputSynapse

initInputStream

protected void initInputStream()
Specified by:
initInputStream in class StreamInputSynapse

setStepCounter

public void setStepCounter(boolean newStepCounter)
Description copied from class: StreamInputSynapse
Inserire qui la descrizione del metodo. Data di creazione: (10/04/00 23.23.26)

Specified by:
setStepCounter in interface InputSynapse
Overrides:
setStepCounter in class StreamInputSynapse
Parameters:
newStepCounter - boolean

gotoLine

public void gotoLine(int numLine)
              throws java.io.IOException
Point to the indicated line into the input stream

Specified by:
gotoLine in interface InputSynapse
Overrides:
gotoLine in class StreamInputSynapse
Throws:
java.io.IOException

dataChanged

public void dataChanged(PlugInEvent data)
Description copied from interface: PlugInListener
This method is called by plug-ins whenever data is changed.

Specified by:
dataChanged in interface PlugInListener
Overrides:
dataChanged in class StreamInputSynapse
Parameters:
data - the event that is send, i.e. the event indicating that the data is changed.

setDecimalPoint

public void setDecimalPoint(char dp)
Specified by:
setDecimalPoint in interface InputSynapse
Overrides:
setDecimalPoint in class StreamInputSynapse

isEOF

public boolean isEOF()
Returns if reached the EOF (10/04/00 23.16.20)

Specified by:
isEOF in interface InputSynapse
Overrides:
isEOF in class StreamInputSynapse
Returns:
boolean

readAll

public void readAll()
Description copied from class: StreamInputSynapse
Reads all input values and fills the buffer

Specified by:
readAll in interface InputSynapse
Overrides:
readAll in class StreamInputSynapse

setBuffered

public void setBuffered(boolean newBuffered)
Description copied from class: StreamInputSynapse
Sets the buffer-mode for this input synapse.

Specified by:
setBuffered in interface InputSynapse
Overrides:
setBuffered in class StreamInputSynapse
Parameters:
newBuffered - boolean

isBuffered

public boolean isBuffered()
Returns if the input synapse is buffered (10/04/00 23.11.30)

Specified by:
isBuffered in interface InputSynapse
Overrides:
isBuffered in class StreamInputSynapse
Returns:
boolean

getPlugIn

public ConverterPlugIn getPlugIn()
Description copied from class: StreamInputSynapse
Gets the attached ConverterPlugin, if any

Overrides:
getPlugIn in class StreamInputSynapse
Returns:
neural.engine.ConverterPlugIn

isStepCounter

public boolean isStepCounter()
Returns if this input layer is an active counter of the steps. Warning: in a neural net there can be only one StepCounter element! (10/04/00 23.23.26)

Specified by:
isStepCounter in interface InputSynapse
Overrides:
isStepCounter in class StreamInputSynapse
Returns:
boolean

gotoFirstLine

public void gotoFirstLine()
                   throws java.io.IOException
Specified by:
gotoFirstLine in interface InputSynapse
Overrides:
gotoFirstLine in class StreamInputSynapse
Throws:
java.io.IOException

removeAllInputs

public void removeAllInputs()

check

public java.util.TreeSet check()
Check that parameters are set correctly.

Specified by:
check in interface NeuralElement
Overrides:
check in class StreamInputSynapse
Returns:
validation errors.
See Also:
Synapse

getFirstRow

public int getFirstRow()
Specified by:
getFirstRow in interface InputSynapse
Overrides:
getFirstRow in class StreamInputSynapse
Returns:
int

getLastRow

public int getLastRow()
Specified by:
getLastRow in interface InputSynapse
Overrides:
getLastRow in class StreamInputSynapse
Returns:
int

getInspections

public java.util.Collection getInspections()

numColumns

public int numColumns()
Overrides:
numColumns in class StreamInputSynapse

getAdvancedColumnSelector

public java.lang.String getAdvancedColumnSelector()
Overrides:
getAdvancedColumnSelector in class StreamInputSynapse


Submit Feedback to pmarrone@users.sourceforge.net