public class INeuron extends AbstractNode<Neuron,Activation> implements Comparable<INeuron>
INeuron class represents a internal neuron implementation in Aikas neural network and is connected to other neurons through
input synapses and output synapses. The activation value of a neuron is calculated by computing the weighted sum
(input act. value * synapse weight) of the input synapses, adding the bias to it and sending the resulting value
through a transfer function (the upper part of tanh).
The neuron does not store its activations by itself. The activation objects are stored within the
logic nodes. To access the activations of this neuron simply use the member variable node or use
the method getFinalActivations(Document doc) to ge the final activations of this neuron.
| Modifier and Type | Class and Description |
|---|---|
static class |
INeuron.ThreadState
The
ThreadState is a thread local data structure containing the activations of a single document for
a specific logic node. |
static class |
INeuron.Type |
| Modifier and Type | Field and Description |
|---|---|
ActivationFunction |
activationFunction |
String |
activationFunctionKey |
static boolean |
ALLOW_WEAK_NEGATIVE_WEIGHTS |
double |
bias |
double |
biasDelta |
double |
biasSum |
double |
biasSumDelta |
TreeMap<Synapse,Synapse> |
inputSynapses |
String |
label |
ReadWriteLock |
lock |
double |
maxRecurrentSum |
double |
metaBias |
double |
negDirSum |
double |
negRecSum |
Provider<OrNode> |
node |
TreeMap<Synapse.Key,Provider<InputNode>> |
outputNodes |
TreeMap<Synapse,Synapse> |
outputSynapses |
String |
outputText |
double |
posDirSum |
double |
posRecSum |
Writable |
statistic |
INeuron.ThreadState[] |
threads |
static double |
TOLERANCE |
INeuron.Type |
type |
static double |
WEIGHT_TOLERANCE |
lastUsedDocumentId, modified, provider| Constructor and Description |
|---|
INeuron(Model m) |
INeuron(Model m,
String label) |
INeuron(Model m,
String label,
String outputText) |
| Modifier and Type | Method and Description |
|---|---|
Activation |
addInput(Document doc,
Activation.Builder input)
Propagate an input activation into the network.
|
void |
changeBias(double bd) |
void |
clearActivations() |
void |
clearActivations(Document doc) |
void |
clearActivations(int threadId) |
int |
compareTo(INeuron n) |
Collection<Activation> |
getActivations(Document doc) |
Stream<Activation> |
getActivationsStream(Document doc) |
Collection<Activation> |
getAllActivations(Document doc) |
Collection<Activation> |
getFinalActivations(Document doc) |
Stream<Activation> |
getFinalActivationsStream(Document doc)
getFinalActivations is a convenience method to retrieve all activations of the given neuron that
are part of the final interpretation. |
Activation |
getFirstActivation(Document doc) |
double |
getNewBiasSum() |
INeuron.ThreadState |
getThreadState(int threadId,
boolean create) |
void |
linkActivation(Activation act)
Sets the incoming and outgoing links between neuron activations.
|
void |
propagate(Activation act)
Propagate an activation to the next node or the next neuron that is depending on the current node.
|
void |
reactivate() |
void |
readFields(DataInput in,
Model m)
Deserialize the fields of this object from
in. |
static INeuron |
readNeuron(DataInput in,
Neuron p) |
void |
register(Activation act) |
void |
remove() |
void |
setBias(double b) |
void |
suspend() |
String |
toString() |
String |
toStringWithSynapses() |
static boolean |
update(Model m,
int threadId,
Document doc,
Neuron pn,
double biasDelta,
Collection<Synapse> modifiedSynapses) |
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
read, setModifiedpublic static boolean ALLOW_WEAK_NEGATIVE_WEIGHTS
public static double WEIGHT_TOLERANCE
public static double TOLERANCE
public String label
public INeuron.Type type
public String outputText
public volatile double bias
public volatile double biasDelta
public volatile double biasSum
public volatile double biasSumDelta
public volatile double metaBias
public volatile double posDirSum
public volatile double negDirSum
public volatile double negRecSum
public volatile double posRecSum
public volatile double maxRecurrentSum
public Writable statistic
public ActivationFunction activationFunction
public String activationFunctionKey
public TreeMap<Synapse.Key,Provider<InputNode>> outputNodes
public ReadWriteLock lock
public INeuron.ThreadState[] threads
public INeuron(Model m)
public INeuron.ThreadState getThreadState(int threadId, boolean create)
public Activation addInput(Document doc, Activation.Builder input)
doc - The current documentinput - public void remove()
public void propagate(Activation act)
AbstractNodepropagate in class AbstractNode<Neuron,Activation>public void linkActivation(Activation act)
act - public Collection<Activation> getActivations(Document doc)
public Activation getFirstActivation(Document doc)
public void clearActivations()
public void clearActivations(Document doc)
public void clearActivations(int threadId)
public int compareTo(INeuron n)
compareTo in interface Comparable<INeuron>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 void suspend()
suspend in class AbstractNode<Neuron,Activation>public void reactivate()
reactivate in class AbstractNode<Neuron,Activation>public void setBias(double b)
public void changeBias(double bd)
public double getNewBiasSum()
public void register(Activation act)
public static boolean update(Model m, int threadId, Document doc, Neuron pn, double biasDelta, Collection<Synapse> modifiedSynapses)
public static INeuron readNeuron(DataInput in, Neuron p) throws IOException
IOExceptionpublic String toStringWithSynapses()
public Stream<Activation> getFinalActivationsStream(Document doc)
getFinalActivations is a convenience method to retrieve all activations of the given neuron that
are part of the final interpretation. Before calling this method, the doc.process() needs to
be called first.doc - The current documentpublic Stream<Activation> getActivationsStream(Document doc)
public Collection<Activation> getFinalActivations(Document doc)
public Collection<Activation> getAllActivations(Document doc)
Copyright © 2018. All rights reserved.