public abstract class Node<T extends Node,A extends NodeActivation<T>> extends AbstractNode<Provider<T>,A> implements Comparable<Node>
Node class 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. The InputNode and
the AndNode classes 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 class
OrNode is 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
Node.RidVisited
Aika extensively uses graph coloring techniques.
|
static class |
Node.ThreadState<T extends Node,A extends NodeActivation>
The
ThreadState is a thread local data structure containing the activations of a single document for
a specific logic node. |
| Modifier and Type | Field and Description |
|---|---|
TreeSet<org.aika.lattice.OrNode.OrEntry> |
allOrChildren |
TreeMap<AndNode.Refinement,Provider<AndNode>> |
andChildren |
static Comparator<NodeActivation.Key> |
BEGIN_COMP |
static Comparator<NodeActivation.Key> |
END_COMP |
boolean |
isDiscovered |
int |
level |
ReadWriteLock |
lock |
long |
markedCreated |
static Node |
MAX_NODE |
static int |
MAX_RELATIVE_RID |
static Node |
MIN_NODE |
AtomicInteger |
numberOfNeuronRefs |
TreeSet<org.aika.lattice.OrNode.OrEntry> |
orChildren |
TreeMap<org.aika.lattice.Node.ReverseAndRefinement,AndNode.Refinement> |
reverseAndChildren |
static Comparator<NodeActivation.Key> |
RID_COMP |
Writable |
statistic |
Node.ThreadState<T,A>[] |
threads |
lastUsedDocumentId, modified, provider| Modifier | Constructor and Description |
|---|---|
protected |
Node() |
|
Node(Model m,
int level) |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Node,A extends NodeActivation<T>> |
addActivation(Document doc,
NodeActivation.Key<T> ak,
Collection<NodeActivation<?>> inputActs)
Add a new activation to this logic node and further propagate this activation through the network.
|
void |
changeNumberOfNeuronRefs(int threadId,
long v,
int d) |
abstract void |
cleanup() |
void |
clearActivations() |
void |
clearActivations(Document doc) |
void |
clearActivations(int threadId) |
int |
compareTo(Node n) |
abstract double |
computeSynapseWeightSum(Integer offset,
INeuron n) |
abstract void |
discover(NodeActivation<T> act,
PatternDiscovery.Config config) |
Collection<A> |
getActivations(Document doc) |
String |
getNeuronLabel() |
Node.ThreadState<T,A> |
getThreadState(int threadId,
boolean create) |
boolean |
isRequired() |
abstract String |
logicToString() |
void |
postCreate(Document doc) |
void |
processChanges(Document doc)
Process all added or removed activation for this logic node.
|
void |
readFields(DataInput in,
Model m)
Deserialize the fields of this object from
in. |
static Node |
readNode(DataInput in,
Provider p) |
void |
register(A act) |
void |
remove() |
abstract void |
reprocessInputs(Document doc) |
String |
toString() |
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
propagate, reactivate, read, setModified, suspendpublic static int MAX_RELATIVE_RID
public static final Node MIN_NODE
public static final Node MAX_NODE
public TreeMap<org.aika.lattice.Node.ReverseAndRefinement,AndNode.Refinement> reverseAndChildren
public TreeMap<AndNode.Refinement,Provider<AndNode>> andChildren
public TreeSet<org.aika.lattice.OrNode.OrEntry> orChildren
public TreeSet<org.aika.lattice.OrNode.OrEntry> allOrChildren
public int level
public Writable statistic
public boolean isDiscovered
public AtomicInteger numberOfNeuronRefs
public ReadWriteLock lock
public Node.ThreadState<T extends Node,A extends NodeActivation<T>>[] threads
public long markedCreated
public static final Comparator<NodeActivation.Key> BEGIN_COMP
public static final Comparator<NodeActivation.Key> END_COMP
public static final Comparator<NodeActivation.Key> RID_COMP
protected Node()
public Node(Model m, int level)
public Node.ThreadState<T,A> getThreadState(int threadId, boolean create)
public abstract void discover(NodeActivation<T> act, PatternDiscovery.Config config)
public abstract void reprocessInputs(Document doc)
public abstract void cleanup()
public abstract String logicToString()
public void postCreate(Document doc)
public void register(A act)
public void processChanges(Document doc)
doc - public static <T extends Node,A extends NodeActivation<T>> void addActivation(Document doc, NodeActivation.Key<T> ak, Collection<NodeActivation<?>> inputActs)
Node.processChanges(Document doc)
is called.doc - ak - inputActs - public void remove()
public boolean isRequired()
public void changeNumberOfNeuronRefs(int threadId,
long v,
int d)
public Collection<A> getActivations(Document doc)
public void clearActivations(Document doc)
public void clearActivations(int threadId)
public void clearActivations()
public String getNeuronLabel()
public int compareTo(Node n)
compareTo in interface Comparable<Node>public void write(DataOutput out) throws IOException
Writableout.write in interface Writableout - DataOuput to serialize this object into.IOExceptionpublic void readFields(DataInput in, Model m) throws IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields in interface Writablein - DataInput to deseriablize this object from.IOExceptionpublic static Node readNode(DataInput in, Provider p) throws IOException
IOExceptionCopyright © 2018. All rights reserved.