Package network.aika

Class Model


  • public class Model
    extends java.lang.Object
    The model consists of two layers. The first layer is the actual neural network consisting of neurons and synapses. The second layer is a pattern lattice containing a boolean logic representation of all the neurons. Whenever the synapse weights of a neuron are adjusted, then the underlying boolean logic representation of this neuron will be updated too.

    The model supports parallel processing using a fixed number of threads.

    Author:
    Lukas Molzberger
    • Field Detail

      • numberOfThreads

        public int numberOfThreads
      • lastCleanup

        public int[] lastCleanup
      • docIdCounter

        public java.util.concurrent.atomic.AtomicInteger docIdCounter
      • currentId

        public java.util.concurrent.atomic.AtomicInteger currentId
      • providers

        public java.util.WeakHashMap<java.lang.Integer,​java.lang.ref.WeakReference<Provider<? extends AbstractNode>>> providers
      • activeProviders

        public java.util.Map<java.lang.Integer,​Provider<? extends AbstractNode>> activeProviders
      • passiveActivationFunctions

        public java.util.Map<java.lang.Integer,​PassiveInputFunction> passiveActivationFunctions
      • defaultThreadId

        public int defaultThreadId
      • visitedCounter

        public static java.util.concurrent.atomic.AtomicLong visitedCounter
    • Constructor Detail

      • Model

        public Model()
        Creates a model with a single thread.
    • Method Detail

      • setSuspensionHook

        public void setSuspensionHook​(SuspensionHook suspensionHook)
      • setNeuronExtensionFactory

        public void setNeuronExtensionFactory​(Model.WritableFactory neuronExtensionFactory)
      • setSynapseExtensionFactory

        public void setSynapseExtensionFactory​(Model.WritableFactory synapseExtensionFactory)
      • setActivationExtensionFactory

        public void setActivationExtensionFactory​(Model.WritableFactory activationExtensionFactory)
      • createNeuron

        public Neuron createNeuron()
      • createNeuron

        public Neuron createNeuron​(java.lang.String label)
      • createNeuron

        public Neuron createNeuron​(java.lang.String label,
                                   java.lang.String outputText)
      • createDocument

        public Document createDocument​(java.lang.String txt)
      • createDocument

        public Document createDocument​(java.lang.String txt,
                                       int threadId)
      • lookupNodeProvider

        public <P extends Provider<? extends Node>> P lookupNodeProvider​(int id)
      • lookupNeuron

        public Neuron lookupNeuron​(int id)
      • register

        public void register​(Provider p)
      • unregister

        public void unregister​(Provider p)
      • suspendUnusedNodes

        public void suspendUnusedNodes​(int docId,
                                       Provider.SuspensionMode sm)
        Suspend all neurons and logic nodes whose last used document id is lower/older than docId.
        Parameters:
        docId -
      • getOldestDocIdInProcessing

        public int getOldestDocIdInProcessing()
      • suspendAll

        public void suspendAll​(Provider.SuspensionMode sm)
        Suspend all neurons and logic nodes in memory.
      • removeProvider

        public void removeProvider​(Provider p)