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 activationsBySlotAndPosition by itself. The activation objects are stored within the
logic nodes. To access the activationsBySlotAndPosition of this neuron simply use the member variable node or use
the method getFinalActivations(Document doc) to ge the final activationsBySlotAndPosition of this neuron.
| Modifier and Type | Class and Description |
|---|---|
static class |
INeuron.ActKey |
static class |
INeuron.ThreadState
The
ThreadState is a thread local data structure containing the activationsBySlotAndPosition of a single document for
a specific logic node. |
static class |
INeuron.Type |
| Modifier and Type | Field and Description |
|---|---|
ActivationFunction |
activationFunction |
static boolean |
ALLOW_WEAK_NEGATIVE_WEIGHTS |
double |
bias |
double |
biasDelta |
double |
biasSum |
double |
biasSumDelta |
Writable |
extension |
TreeMap<Synapse,Synapse> |
inputSynapses |
String |
label |
ReadWriteLock |
lock |
double |
negDirSum |
double |
negRecSum |
Provider<OrNode> |
node |
int |
numDisjunctiveSynapses |
Provider<InputNode> |
outputNode |
Map<Integer,Relation> |
outputRelations |
TreeMap<Synapse,Synapse> |
outputSynapses |
PassiveInputFunction |
passiveInputFunction |
TreeMap<Synapse,Synapse> |
passiveInputSynapses |
double |
posDirSum |
double |
posPassiveSum |
double |
posRecSum |
double |
requiredSum |
Set<Integer> |
slotHasInputs |
Set<Integer> |
slotRequired |
int |
synapseIdCounter |
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) |
Stream<Activation> |
getActivations(Document doc,
boolean onlyFinal) |
Stream<Activation> |
getActivations(Document doc,
int slot,
Position pos,
boolean onlyFinal) |
double |
getNewBiasSum() |
int |
getNewSynapseId() |
String |
getOutputText() |
INeuron.ThreadState |
getThreadState(int threadId,
boolean create) |
boolean |
isPassiveInputNeuron() |
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 |
registerPassiveInputSynapse(Synapse s) |
void |
registerSynapseId(Integer synId) |
void |
remove() |
void |
setBias(double b) |
void |
setOutputText(String outputText) |
void |
suspend() |
String |
toString() |
String |
toStringWithSynapses() |
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 volatile double bias
public volatile double biasDelta
public volatile double biasSum
public volatile double biasSumDelta
public volatile double posDirSum
public volatile double negDirSum
public volatile double negRecSum
public volatile double posRecSum
public volatile double posPassiveSum
public volatile double requiredSum
public volatile int numDisjunctiveSynapses
public Writable extension
public ActivationFunction activationFunction
public int synapseIdCounter
public ReadWriteLock lock
public PassiveInputFunction passiveInputFunction
public INeuron.ThreadState[] threads
public INeuron(Model m)
public INeuron.ThreadState getThreadState(int threadId, boolean create)
public void setOutputText(String outputText)
public String getOutputText()
public Activation addInput(Document doc, Activation.Builder input)
doc - The current documentinput - public void remove()
public int getNewSynapseId()
public void registerSynapseId(Integer synId)
public void propagate(Activation act)
AbstractNodepropagate in class AbstractNode<Neuron,Activation>public Stream<Activation> getActivations(Document doc, boolean onlyFinal)
public Stream<Activation> getActivations(Document doc, int slot, Position pos, boolean onlyFinal)
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 INeuron readNeuron(DataInput in, Neuron p) throws IOException
IOExceptionpublic boolean isPassiveInputNeuron()
public void registerPassiveInputSynapse(Synapse s)
public String toStringWithSynapses()
Copyright © 2018. All rights reserved.