org.encog.neural.networks.synapse
Class OneToOneSynapse

java.lang.Object
  extended by org.encog.persist.BasicPersistedSubObject
      extended by org.encog.neural.networks.synapse.BasicSynapse
          extended by org.encog.neural.networks.synapse.OneToOneSynapse
All Implemented Interfaces:
Serializable, Synapse, EncogPersistedObject

public class OneToOneSynapse
extends BasicSynapse

A one-to-one synapse requires that the from and to layers have exactly the same number of neurons. A one-to-one synapse can be useful, when used in conjunction with a ContextLayer. This synapse is not teachable.

Author:
jheaton
See Also:
Serialized Form

Constructor Summary
OneToOneSynapse()
          Simple default constructor.
OneToOneSynapse(Layer fromLayer, Layer toLayer)
          Construct a one-to-one synapse between the two layers.
 
Method Summary
 Object clone()
           
 NeuralData compute(NeuralData input)
          Compute the output from this synapse.
 Persistor createPersistor()
          Create a persistor for this object.
 Matrix getMatrix()
          Get the weight matrix.
 int getMatrixSize()
          Get the size of the matrix, or zero if one is not defined.
 SynapseType getType()
           
 boolean isTeachable()
           
 void setMatrix(Matrix matrix)
          Attempt to set the matrix for this layer.
 
Methods inherited from class org.encog.neural.networks.synapse.BasicSynapse
getFromLayer, getFromNeuronCount, getToLayer, getToNeuronCount, isSelfConnected, setFromLayer, setName, setToLayer, toString
 
Methods inherited from class org.encog.persist.BasicPersistedSubObject
getCollection, getDescription, getName, setCollection, setDescription
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.encog.persist.EncogPersistedObject
getCollection, getDescription, getName, setCollection, setDescription
 

Constructor Detail

OneToOneSynapse

public OneToOneSynapse()
Simple default constructor.


OneToOneSynapse

public OneToOneSynapse(Layer fromLayer,
                       Layer toLayer)
Construct a one-to-one synapse between the two layers.

Parameters:
fromLayer - The starting layer.
toLayer - The ending layer.
Method Detail

clone

public Object clone()
Specified by:
clone in interface Synapse
Specified by:
clone in class BasicSynapse
Returns:
A clone of this object.

compute

public NeuralData compute(NeuralData input)
Compute the output from this synapse.

Parameters:
input - The input to this synapse.
Returns:
The output is the same as the input.

createPersistor

public Persistor createPersistor()
Description copied from interface: EncogPersistedObject
Create a persistor for this object.

Returns:
null, this synapse type has no matrix.

getMatrix

public Matrix getMatrix()
Description copied from interface: Synapse
Get the weight matrix.

Returns:
null, this synapse type has no matrix.

getMatrixSize

public int getMatrixSize()
Description copied from interface: Synapse
Get the size of the matrix, or zero if one is not defined.

Returns:
0, this synapse type has no matrix.

getType

public SynapseType getType()
Returns:
The type of synapse that this is.

isTeachable

public boolean isTeachable()
Returns:
False, because this type of synapse is not teachable.

setMatrix

public void setMatrix(Matrix matrix)
Attempt to set the matrix for this layer. This will throw an error, because this layer type does not have a matrix.

Parameters:
matrix - Not used.


Copyright © 2011. All Rights Reserved.