Class INeuron

  • All Implemented Interfaces:
    java.lang.Comparable<INeuron>, Writable

    public class INeuron
    extends AbstractNode<Neuron>
    implements java.lang.Comparable<INeuron>
    The 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.

    Author:
    Lukas Molzberger
    • Field Detail

      • ALLOW_WEAK_NEGATIVE_WEIGHTS

        public static boolean ALLOW_WEAK_NEGATIVE_WEIGHTS
      • WEIGHT_TOLERANCE

        public static double WEIGHT_TOLERANCE
      • MIN_NEURON

        public static final INeuron MIN_NEURON
      • MAX_NEURON

        public static final INeuron MAX_NEURON
      • slotHasInputs

        public java.util.Set<java.lang.Integer> slotHasInputs
      • slotRequired

        public java.util.Set<java.lang.Integer> slotRequired
    • Method Detail

      • getLabel

        public java.lang.String getLabel()
      • getOutputRelations

        public java.util.Map<java.lang.Integer,​Relation> getOutputRelations()
      • getInputSynapses

        public java.util.Collection<Synapse> getInputSynapses()
      • getPassiveInputSynapses

        public java.util.Collection<Synapse> getPassiveInputSynapses()
      • addRequiredSlot

        public void addRequiredSlot​(int slot)
      • getExtension

        public <T extends Writable> T getExtension()
      • addActivation

        public boolean addActivation​(Activation act)
      • getActivations

        public java.util.stream.Stream<Activation> getActivations​(Document doc)
      • isEmpty

        public boolean isEmpty​(Document doc)
      • size

        public int size​(Document doc)
      • clearActivations

        public void clearActivations​(Document doc)
      • getActivations

        public java.util.stream.Stream<Activation> getActivations​(Document doc,
                                                                  int slot,
                                                                  Position pos,
                                                                  boolean onlyFinal)
      • clearActivations

        public void clearActivations()
      • clearActivations

        public void clearActivations​(int threadId)
      • getActivations

        public java.util.stream.Stream<Activation> getActivations​(Document doc,
                                                                  int fromSlot,
                                                                  Position fromPos,
                                                                  boolean fromInclusive,
                                                                  int toSlot,
                                                                  Position toPos,
                                                                  boolean toInclusive)
      • getActivations

        public java.util.stream.Stream<Activation> getActivations​(Document doc,
                                                                  boolean onlyFinal)
      • getActivations

        public java.util.Collection<Activation> getActivations​(Document doc,
                                                               java.util.SortedMap<java.lang.Integer,​Position> slots)
      • setOutputText

        public void setOutputText​(java.lang.String outputText)
      • getOutputText

        public java.lang.String getOutputText()
      • commit

        public void commit​(java.util.Collection<Synapse> modifiedSynapses)
      • checkRequiredSlots

        public boolean checkRequiredSlots​(Document doc,
                                          java.util.SortedMap<java.lang.Integer,​Position> slots)
      • remove

        public void remove()
      • getNewSynapseId

        public int getNewSynapseId()
      • registerSynapseId

        public void registerSynapseId​(java.lang.Integer synId)
      • propagate

        public void propagate​(Activation act)
      • compareTo

        public int compareTo​(INeuron n)
        Specified by:
        compareTo in interface java.lang.Comparable<INeuron>
      • write

        public void write​(java.io.DataOutput out)
                   throws java.io.IOException
        Description copied from interface: Writable
        Serialize the fields of this object to out.
        Specified by:
        write in interface Writable
        Parameters:
        out - DataOuput to serialize this object into.
        Throws:
        java.io.IOException
      • readFields

        public void readFields​(java.io.DataInput in,
                               Model m)
                        throws java.io.IOException
        Description copied from interface: Writable
        Deserialize the fields of this object from in.

        For efficiency, implementations should attempt to re-use storage in the existing object where possible.

        Specified by:
        readFields in interface Writable
        Parameters:
        in - DataInput to deseriablize this object from.
        Throws:
        java.io.IOException
      • setBias

        public void setBias​(double b)
      • updateBiasDelta

        public void updateBiasDelta​(double biasDelta)
      • getBias

        public double getBias()
      • getNewBias

        public double getNewBias()
      • register

        public void register​(Activation act)
      • readNeuron

        public static INeuron readNeuron​(java.io.DataInput in,
                                         Neuron p)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • isPassiveInputNeuron

        public boolean isPassiveInputNeuron()
      • registerPassiveInputSynapse

        public void registerPassiveInputSynapse​(Synapse s)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringWithSynapses

        public java.lang.String toStringWithSynapses()