public abstract class Node<T extends Node,A extends NodeActivation<T>> extends AbstractNode<Provider<T>> 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<T>>
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 |
|---|---|
static Comparator<NodeActivation.Key> |
BEGIN_COMP |
static Comparator<NodeActivation.Key> |
END_COMP |
boolean |
endRequired |
int |
frequency |
boolean |
frequencyHasChanged |
int |
instanceSum |
boolean |
isDiscovered |
boolean |
isQueued |
int |
level |
ReadWriteLock |
lock |
static Node |
MAX_NODE |
static int |
MAX_RID |
static Node |
MIN_NODE |
int |
nOffset |
double |
nullHypFreq |
int |
numberOfNeuronRefs |
double |
oldNullHypFreq |
long |
queueId |
static Comparator<NodeActivation.Key> |
RID_COMP |
boolean |
ridRequired |
int |
sizeSum |
Node.ThreadState<T,A>[] |
threads |
static long |
visitedCounter |
lastUsedDocumentId, 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>> |
addActivationAndPropagate(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.
|
abstract void |
changeNumberOfNeuronRefs(int threadId,
long v,
int d) |
abstract void |
cleanup(Model m) |
void |
clearActivations(Document doc) |
void |
clearActivations(int threadId) |
void |
clearActivations(Model m) |
int |
compareTo(Node n) |
abstract void |
computeNullHyp(Model m) |
abstract double |
computeSynapseWeightSum(Integer offset,
INeuron n) |
void |
count(int threadId) |
abstract void |
discover(Document doc,
NodeActivation<T> act,
TrainConfig trainConfig) |
Collection<A> |
getActivations(Document doc) |
A |
getFirstActivation(Document doc) |
String |
getNeuronLabel() |
Node.ThreadState<T,A> |
getThreadState(int threadId,
boolean create) |
abstract boolean |
isAllowedOption(int threadId,
InterprNode n,
NodeActivation<?> act,
long v) |
boolean |
isCovered(int threadId,
Integer offset,
long v) |
abstract boolean |
isExpandable() |
boolean |
isPublic() |
boolean |
isRequired() |
abstract String |
logicToString() |
void |
processChanges(Document doc)
Process all added or removed activation for this logic node.
|
abstract void |
propagateAddedActivation(Document doc,
A act,
InterprNode conflict)
Propagate an activation to the next node or the next neuron that is depending on the current node.
|
abstract void |
propagateRemovedActivation(Document doc,
NodeActivation act) |
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,
Document doc) |
static <T extends Node,A extends NodeActivation<T>> |
removeActivationAndPropagate(Document doc,
A act,
Collection<NodeActivation<?>> inputActs) |
String |
toString() |
void |
unregister(A act,
Document doc) |
String |
weightsToString() |
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
reactivate, read, suspendpublic static int MAX_RID
public static final Node MIN_NODE
public static final Node MAX_NODE
public int level
public volatile int frequency
public volatile double nullHypFreq
public volatile double oldNullHypFreq
public boolean isDiscovered
public boolean endRequired
public boolean ridRequired
public volatile int numberOfNeuronRefs
public volatile boolean frequencyHasChanged
public volatile int nOffset
public volatile int sizeSum
public volatile int instanceSum
public ReadWriteLock lock
public boolean isQueued
public long queueId
public static long visitedCounter
public Node.ThreadState<T extends Node,A extends NodeActivation<T>>[] threads
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 propagateAddedActivation(Document doc, A act, InterprNode conflict)
doc - act - conflict - public abstract void propagateRemovedActivation(Document doc, NodeActivation act)
public abstract boolean isAllowedOption(int threadId,
InterprNode n,
NodeActivation<?> act,
long v)
public abstract void cleanup(Model m)
public abstract String logicToString()
public abstract void discover(Document doc, NodeActivation<T> act, TrainConfig trainConfig)
public abstract void computeNullHyp(Model m)
public abstract boolean isExpandable()
public abstract void changeNumberOfNeuronRefs(int threadId,
long v,
int d)
public void count(int threadId)
public void processChanges(Document doc)
doc - public static <T extends Node,A extends NodeActivation<T>> void addActivationAndPropagate(Document doc, NodeActivation.Key<T> ak, Collection<NodeActivation<?>> inputActs)
Node.processChanges(Document doc)
is called.doc - ak - inputActs - public static <T extends Node,A extends NodeActivation<T>> void removeActivationAndPropagate(Document doc, A act, Collection<NodeActivation<?>> inputActs)
public Collection<A> getActivations(Document doc)
public void clearActivations(Document doc)
public void clearActivations(int threadId)
public void clearActivations(Model m)
public boolean isPublic()
public boolean isCovered(int threadId,
Integer offset,
long v)
throws Node.ThreadState.RidOutOfRange
Node.ThreadState.RidOutOfRangepublic boolean isRequired()
public String getNeuronLabel()
public String weightsToString()
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 © 2017. All rights reserved.