Class Neuron

  • All Implemented Interfaces:
    java.lang.Comparable<Provider<?>>

    public class Neuron
    extends Provider<INeuron>
    The Neuron class is a proxy implementation for the real neuron implementation in the class INeuron. Aika uses the provider pattern to store and reload rarely used neurons or logic nodes.
    Author:
    Lukas Molzberger
    • Field Detail

      • MIN_NEURON

        public static final Neuron MIN_NEURON
      • MAX_NEURON

        public static final Neuron MAX_NEURON
    • Constructor Detail

      • Neuron

        public Neuron​(Model m,
                      int id)
    • Method Detail

      • getLabel

        public java.lang.String getLabel()
      • addInput

        public Activation addInput​(Document doc,
                                   int begin,
                                   int end)
        Propagate an input activation into the network.
        Parameters:
        doc - The current document
        begin - The range begin
        end - The range end
      • addInput

        public Activation addInput​(Document doc,
                                   Activation.Builder inputAct)
        Propagate an input activation into the network.
        Parameters:
        doc - The current document
        inputAct -
      • init

        public static Neuron init​(Neuron n,
                                  double bias,
                                  INeuron.Type type,
                                  java.util.Collection<Synapse.Builder> synapseBuilders,
                                  java.util.Collection<Relation.Builder> relationBuilders)
        Creates a neuron with the given bias.
        Parameters:
        n -
        bias -
        synapseBuilders -
        relationBuilders -
        Returns:
      • setOutputText

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

        public Synapse getSynapseById​(int synapseId)
      • getActivations

        public java.util.stream.Stream<Activation> getActivations​(Document doc,
                                                                  boolean onlyFinal)
        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. getFinalActivations requires that the doc.process() method has been called first.
        Parameters:
        doc - The current document
        Returns:
        A collection with all final activations of this neuron.
      • getActivations

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

        public Activation getActivation​(Document doc,
                                        int begin,
                                        int end,
                                        boolean onlyFinal)
      • selectInputSynapse

        public Synapse selectInputSynapse​(Neuron inputNeuron,
                                          java.util.function.Predicate<Synapse> filter)
      • getNewSynapseId

        public int getNewSynapseId()
      • registerSynapseId

        public void registerSynapseId​(int synId)
      • getInMemoryInputSynapses

        public java.util.Collection<Synapse> getInMemoryInputSynapses()
      • getInMemoryOutputSynapses

        public java.util.Collection<Synapse> getInMemoryOutputSynapses()