Package network.aika.lattice
Class Node<T extends Node,A extends NodeActivation<T>>
- java.lang.Object
-
- network.aika.AbstractNode<Provider<T>>
-
- network.aika.lattice.Node<T,A>
-
- All Implemented Interfaces:
Comparable<Node>,Writable
public abstract class Node<T extends Node,A extends NodeActivation<T>> extends AbstractNode<Provider<T>> implements Comparable<Node>
TheNodeclass is the abstract class for all the boolean logic nodes underneath the neural network layer. These nodes form a boolean representation for all the neurons of the neural network. Whenever changes occur to the synapse weights in the neural layer, then the structure of the boolean representation needs to be adjusted. Several neurons, however, might share common substructures in this boolean representation. TheInputNodeand theAndNodeclasses together form a pattern lattice, containing all possible substructures of any given conjunction. For example if we have the conjunction ABCD where A, B, C, D are the inputs then the pattern lattice will contain the nodes ABCD, ABC, ABD, ACD, BCD, AB, AC, AD, BC, BD, CD, A, B, C, D. The classOrNodeis a disjunction of either input-nodes or and-nodes. The or-node is connected with one of the neurons.Each logic node has a set of activations. The activations are stored in the thread local data structure
ThreadState.- Author:
- Lukas Molzberger
-
-
Field Summary
Fields Modifier and Type Field Description intlevelprotected ReadWriteLocklockstatic NodeMAX_NODEstatic NodeMIN_NODE-
Fields inherited from class network.aika.AbstractNode
lastUsedDocumentId, modified, provider
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddActivation(A act)Add a new activation to this logic node and further propagate this activation through the network.protected voidchangeNumberOfNeuronRefs(int threadId, long v, int d)abstract voidcleanup()voidclearActivations()voidclearActivations(int threadId)voidclearActivations(Document doc)voidclearThreadState(int threadId, int deleteDocId)static intcompareRank(int threadId, Node n1, Node n2)intcompareTo(Node n)Collection<A>getActivations(Document doc)StringgetNeuronLabel()booleanisNeuron()booleanisQueued(int threadId, long queueId)booleanisRequired()abstract StringlogicToString()voidpostCreate(Document doc)voidprocessChanges(Document doc)Process all added or removed activation for this logic node.protected abstract voidpropagate(A act)Propagate an activation to the next node or the next neuron that is depending on the current node.protected voidpropagateToOrNode(NodeActivation inputAct)voidreadFields(DataInput in, Model m)Deserialize the fields of this object fromin.static NodereadNode(DataInput in, Provider p)voidregister(A act)voidremove()abstract voidreprocessInputs(Document doc)voidsetNotQueued(int threadId)StringtoString()voidwrite(DataOutput out)Serialize the fields of this object toout.-
Methods inherited from class network.aika.AbstractNode
addModelLabel, delete, getLabel, getModelLabels, getProvider, reactivate, read, setModified, suspend
-
-
-
-
Field Detail
-
MIN_NODE
public static final Node MIN_NODE
-
MAX_NODE
public static final Node MAX_NODE
-
level
public int level
-
lock
protected ReadWriteLock lock
-
-
Constructor Detail
-
Node
protected Node()
-
Node
public Node(Model m, int level)
-
-
Method Detail
-
propagate
protected abstract void propagate(A act)
Propagate an activation to the next node or the next neuron that is depending on the current node.- Parameters:
act-
-
clearThreadState
public void clearThreadState(int threadId, int deleteDocId)
-
reprocessInputs
public abstract void reprocessInputs(Document doc)
-
cleanup
public abstract void cleanup()
-
logicToString
public abstract String logicToString()
-
postCreate
public void postCreate(Document doc)
-
register
public void register(A act)
-
clearActivations
public void clearActivations(Document doc)
-
clearActivations
public void clearActivations(int threadId)
-
clearActivations
public void clearActivations()
-
processChanges
public void processChanges(Document doc)
Process all added or removed activation for this logic node.- Parameters:
doc-
-
propagateToOrNode
protected void propagateToOrNode(NodeActivation inputAct)
-
addActivation
public void addActivation(A act)
Add a new activation to this logic node and further propagate this activation through the network. This activation, however, will not be added immediately. This method only adds a request to the activations queue in the document. The activation will be added when the methodNode.processChanges(Document doc)is called.- Parameters:
act-
-
remove
public void remove()
-
isRequired
public boolean isRequired()
-
changeNumberOfNeuronRefs
protected void changeNumberOfNeuronRefs(int threadId, long v, int d)
-
getActivations
public Collection<A> getActivations(Document doc)
-
getNeuronLabel
public String getNeuronLabel()
-
isQueued
public boolean isQueued(int threadId, long queueId)
-
setNotQueued
public void setNotQueued(int threadId)
-
compareTo
public int compareTo(Node n)
- Specified by:
compareToin interfaceComparable<T extends Node>
-
write
public void write(DataOutput out) throws IOException
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Overrides:
writein classAbstractNode<Provider<T extends Node>>- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException
-
readFields
public void readFields(DataInput in, Model m) throws IOException
Description 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- Overrides:
readFieldsin classAbstractNode<Provider<T extends Node>>- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException
-
readNode
public static Node readNode(DataInput in, Provider p) throws IOException
- Throws:
IOException
-
isNeuron
public boolean isNeuron()
- Specified by:
isNeuronin classAbstractNode<Provider<T extends Node>>
-
-