public class Neuron extends Object implements Comparable<Neuron>, Writable
Neuron class represents a neuron 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 |
Neuron.NormWeight |
| Modifier and Type | Field and Description |
|---|---|
double |
activationSum |
double |
bias |
static AtomicInteger |
currentNeuronId |
int |
id |
boolean |
initialized |
TreeSet<Synapse> |
inputSynapses |
TreeSet<Synapse> |
inputSynapsesByWeight |
boolean |
isBlocked |
String |
label |
static double |
LEARN_RATE |
ReadWriteLock |
lock |
Model |
m |
static int |
MAX_SELF_REFERENCING_DEPTH |
double |
maxRecurrentSum |
double |
negDirSum |
double |
negRecSum |
Node |
node |
boolean |
noTraining |
int |
numberOfActivations |
TreeMap<Synapse.Key,InputNode> |
outputNodes |
TreeSet<Synapse> |
outputSynapses |
double |
posRecSum |
static double |
TOLERANCE |
static double |
WEIGHT_TOLERANCE |
| Constructor and Description |
|---|
Neuron() |
Neuron(String label) |
Neuron(String label,
boolean isBlocked,
boolean noTraining) |
| Modifier and Type | Method and Description |
|---|---|
double |
avgActivation() |
int |
compareTo(Neuron n) |
void |
computeBounds(Activation act) |
void |
computeErrorSignal(Document doc,
Activation act) |
Activation.State |
computeWeight(int round,
Activation act,
SearchNode en,
Document doc) |
void |
count(Document doc) |
static Neuron |
create(Document doc,
Neuron n,
double bias,
double negDirSum,
double negRecSum,
double posRecSum,
Set<Synapse> inputs) |
Collection<Activation> |
getFinalActivations(Document doc)
getFinalActivations is a convenience method to retrieve all activations of the given neuron that
are part of the final interpretation. |
void |
propagateAddedActivation(Document doc,
Activation act) |
void |
propagateRemovedActivation(Document doc,
Activation act) |
void |
publish(Document doc) |
static Neuron |
read(DataInput in,
Document doc) |
void |
readFields(DataInput in,
Document doc)
Deserialize the fields of this object from
in. |
void |
remove(Document doc) |
static double |
sigmoid(double x) |
String |
toString() |
String |
toStringWithSynapses() |
void |
train(Document doc,
Activation act) |
void |
train(Document doc,
Activation iAct,
Integer rid,
double x,
long v) |
static double |
transferFunction(double x) |
void |
unpublish(Document doc) |
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
public static final double LEARN_RATE
public static final double WEIGHT_TOLERANCE
public static final double TOLERANCE
public static final int MAX_SELF_REFERENCING_DEPTH
public Model m
public static AtomicInteger currentNeuronId
public int id
public String label
public volatile double bias
public volatile double negDirSum
public volatile double negRecSum
public volatile double posRecSum
public volatile double maxRecurrentSum
public TreeMap<Synapse.Key,InputNode> outputNodes
public Node node
public boolean initialized
public boolean isBlocked
public boolean noTraining
public volatile double activationSum
public volatile int numberOfActivations
public ReadWriteLock lock
public Neuron()
public Neuron(String label)
public Neuron(String label, boolean isBlocked, boolean noTraining)
public double avgActivation()
public static Neuron create(Document doc, Neuron n, double bias, double negDirSum, double negRecSum, double posRecSum, Set<Synapse> inputs)
public void publish(Document doc)
public void unpublish(Document doc)
public void remove(Document doc)
public void propagateAddedActivation(Document doc, Activation act)
public void propagateRemovedActivation(Document doc, Activation act)
public void computeBounds(Activation act)
public Activation.State computeWeight(int round, Activation act, SearchNode en, Document doc)
public void computeErrorSignal(Document doc, Activation act)
public void train(Document doc, Activation act)
public void train(Document doc, Activation iAct, Integer rid, double x, long v)
public static double transferFunction(double x)
public static double sigmoid(double x)
public void count(Document doc)
public void write(DataOutput out) throws IOException
Writableout.write in interface Writableout - DataOuput to serialize this object into.IOExceptionpublic void readFields(DataInput in, Document doc) 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 Neuron read(DataInput in, Document doc) throws IOException
IOExceptionpublic int compareTo(Neuron n)
compareTo in interface Comparable<Neuron>public String toStringWithSynapses()
public Collection<Activation> getFinalActivations(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 documentCopyright © 2017. All rights reserved.