Class Synapse
- java.lang.Object
-
- network.aika.neuron.Synapse
-
- All Implemented Interfaces:
Writable
public class Synapse extends java.lang.Object implements Writable
TheSynapseclass connects two neurons with each other. When propagating an activation signal, the weight of the synapse is multiplied with the activation value of the input neurons activation. The result is then added to the output neurons weighted sum to compute the output activation value. In contrast to a conventional neural network synapses in Aika do not just propagate the activation value from one neuron to the next, but also structural information like the text range and the relational id (e.g. word position) and also the interpretation to which the input activation belongs. To determine in which way the structural information should be propagated synapses in Aika possess a few more properties.The properties
relativeRidandabsoluteRiddetermine either the relative difference between theridof the input activation and the rid of the output activation or require a fixed rid as input.The properties range match, range mapping and range output manipulate the ranges. The range match determines whether the input range begin or end is required to be equal, greater than or less than the range of the output activation. The range mapping can be used to map for example an input range end to an output range begin. Usually this simply maps begin to begin and end to end. The range output property is a boolean flag which determines whether the input range should be propagated to the output activation.
Furthermore, the property
isRecurrentspecifies if this synapse is a recurrent feedback link. Recurrent feedback links can be either negative or positive depending on the weight of the synapse. Recurrent feedback links kind of allow to use future information as inputs of a current neuron. Aika allows this by making assumptions about the recurrent input neuron. The classSearchNodemodifies these assumptions until the best interpretation for this document is found.- Author:
- Lukas Molzberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSynapse.BuilderTheBuilderclass is just a helper class which is used to initialize a neuron.static classSynapse.State
-
Field Summary
Fields Modifier and Type Field Description static doubleCONJUNCTION_THRESHOLDstatic doubleDISJUNCTION_THRESHOLDstatic java.util.Comparator<Synapse>INPUT_SYNAPSE_COMPstatic intOUTPUTstatic java.util.Comparator<Synapse>OUTPUT_SYNAPSE_COMPstatic doubleTOLERANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()static SynapsecreateOrReplace(Document doc, java.lang.Integer synapseId, Neuron inputNeuron, Neuron outputNeuron)booleanexists()doublegetBias()DistanceFunctiongetDistanceFunction()<T extends Writable>
TgetExtension()java.lang.IntegergetId()NeurongetInput()doublegetLimit()doublegetMaxInputValue()doublegetNewBias()doublegetNewLimit()doublegetNewWeight()NeurongetOutput()RelationgetRelationById(java.lang.Integer id)java.util.Map<java.lang.Integer,Relation>getRelations()doublegetWeight()booleanisConjunction()booleanisConjunction(Synapse.State state)booleanisDisjunction()booleanisDisjunction(Synapse.State state)booleanisIdentity()booleanisInactive()booleanisNegative()booleanisRecurrent()booleanisZero()voidlink()booleanlinksAnyOutput()java.util.Set<java.lang.Integer>linksOutput()static Synapseread(java.io.DataInput in, Model m)voidreadFields(java.io.DataInput in, Model m)Deserialize the fields of this object fromin.voidrelink()voidsetDistanceFunction(DistanceFunction distanceFunction)voidsetExtension(Writable extension)voidsetIdentity(boolean identity)voidsetInactive(boolean inactive)voidsetRecurrent(boolean recurrent)voidsetRelations(java.util.Map<java.lang.Integer,Relation> relations)java.lang.StringtoString()voidunlink()voidupdate(Document doc, double weight, double bias, double limit)voidupdateDelta(Document doc, double weightDelta, double biasDelta, double limitDelta)voidwrite(java.io.DataOutput out)Serialize the fields of this object toout.
-
-
-
Field Detail
-
OUTPUT
public static final int OUTPUT
- See Also:
- Constant Field Values
-
DISJUNCTION_THRESHOLD
public static double DISJUNCTION_THRESHOLD
-
CONJUNCTION_THRESHOLD
public static double CONJUNCTION_THRESHOLD
-
TOLERANCE
public static double TOLERANCE
-
INPUT_SYNAPSE_COMP
public static final java.util.Comparator<Synapse> INPUT_SYNAPSE_COMP
-
OUTPUT_SYNAPSE_COMP
public static final java.util.Comparator<Synapse> OUTPUT_SYNAPSE_COMP
-
-
Method Detail
-
getInput
public Neuron getInput()
-
getOutput
public Neuron getOutput()
-
getId
public java.lang.Integer getId()
-
isRecurrent
public boolean isRecurrent()
-
setRecurrent
public void setRecurrent(boolean recurrent)
-
isIdentity
public boolean isIdentity()
-
setIdentity
public void setIdentity(boolean identity)
-
getRelations
public java.util.Map<java.lang.Integer,Relation> getRelations()
-
setRelations
public void setRelations(java.util.Map<java.lang.Integer,Relation> relations)
-
getDistanceFunction
public DistanceFunction getDistanceFunction()
-
setDistanceFunction
public void setDistanceFunction(DistanceFunction distanceFunction)
-
getExtension
public <T extends Writable> T getExtension()
-
setExtension
public void setExtension(Writable extension)
-
isInactive
public boolean isInactive()
-
setInactive
public void setInactive(boolean inactive)
-
isConjunction
public boolean isConjunction()
-
isDisjunction
public boolean isDisjunction()
-
getWeight
public double getWeight()
-
getBias
public double getBias()
-
getLimit
public double getLimit()
-
getNewWeight
public double getNewWeight()
-
getNewBias
public double getNewBias()
-
getNewLimit
public double getNewLimit()
-
link
public void link()
-
relink
public void relink()
-
unlink
public void unlink()
-
getMaxInputValue
public double getMaxInputValue()
-
exists
public boolean exists()
-
commit
public void commit()
-
isZero
public boolean isZero()
-
isConjunction
public boolean isConjunction(Synapse.State state)
-
isDisjunction
public boolean isDisjunction(Synapse.State state)
-
updateDelta
public void updateDelta(Document doc, double weightDelta, double biasDelta, double limitDelta)
-
update
public void update(Document doc, double weight, double bias, double limit)
-
isNegative
public boolean isNegative()
-
getRelationById
public Relation getRelationById(java.lang.Integer id)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
write
public void write(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from interface:WritableSerialize the fields of this object toout.
-
readFields
public void readFields(java.io.DataInput in, Model m) throws java.io.IOExceptionDescription copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
java.io.IOException
-
read
public static Synapse read(java.io.DataInput in, Model m) throws java.io.IOException
- Throws:
java.io.IOException
-
createOrReplace
public static Synapse createOrReplace(Document doc, java.lang.Integer synapseId, Neuron inputNeuron, Neuron outputNeuron)
-
linksOutput
public java.util.Set<java.lang.Integer> linksOutput()
-
linksAnyOutput
public boolean linksAnyOutput()
-
-