Package network.aika
Class Model
- java.lang.Object
-
- network.aika.Model
-
public class Model extends 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModel.StaleDocumentException
-
Field Summary
Fields Modifier and Type Field Description Map<Integer,Provider<? extends AbstractNode>>activeProvidersAtomicIntegercurrentIdintdefaultThreadIdAtomicIntegerdocIdCounterDocument[]docsint[]lastCleanupModelLabelCallbackmodelLabelCallbackintnumberOfAvailableThreadsintnumberOfThreadsMap<Integer,PassiveInputFunction>passiveActivationFunctionsWeakHashMap<Integer,WeakReference<Provider<? extends AbstractNode>>>providersSuspensionHooksuspensionHookstatic AtomicLongvisitedCounter
-
Constructor Summary
Constructors Constructor Description Model()Creates a model with a single thread.Model(SuspensionHook sh, int numberOfThreads)
-
Method Summary
-
-
-
Field Detail
-
numberOfThreads
public int numberOfThreads
-
numberOfAvailableThreads
public int numberOfAvailableThreads
-
lastCleanup
public int[] lastCleanup
-
docs
public Document[] docs
-
suspensionHook
public SuspensionHook suspensionHook
-
docIdCounter
public AtomicInteger docIdCounter
-
currentId
public AtomicInteger currentId
-
providers
public WeakHashMap<Integer,WeakReference<Provider<? extends AbstractNode>>> providers
-
activeProviders
public Map<Integer,Provider<? extends AbstractNode>> activeProviders
-
passiveActivationFunctions
public Map<Integer,PassiveInputFunction> passiveActivationFunctions
-
defaultThreadId
public int defaultThreadId
-
visitedCounter
public static AtomicLong visitedCounter
-
modelLabelCallback
public ModelLabelCallback modelLabelCallback
-
-
Constructor Detail
-
Model
public Model()
Creates a model with a single thread.
-
Model
public Model(SuspensionHook sh, int numberOfThreads)
-
-
Method Detail
-
getModelLabelCallback
public ModelLabelCallback getModelLabelCallback()
-
setModelLabelCallback
public void setModelLabelCallback(ModelLabelCallback modelLabelCallback)
-
acquireThread
public void acquireThread(Document doc)
-
releaseThread
public void releaseThread(Document doc)
-
dumpThreadState
public void dumpThreadState()
-
getSuspensionHook
public SuspensionHook getSuspensionHook()
-
setSuspensionHook
public void setSuspensionHook(SuspensionHook suspensionHook)
-
createNeuron
public Neuron createNeuron(INeuron.Type type)
-
createNeuron
public Neuron createNeuron(String label, INeuron.Type type)
-
createNeuron
public Neuron createNeuron(String label, INeuron.Type type, ActivationFunction actF)
-
createNeuron
public Neuron createNeuron(String label, INeuron.Type type, String outputText)
-
createNeuron
public Neuron createNeuron(String label, INeuron.Type type, ActivationFunction actF, String outputText)
-
readNeuron
public INeuron readNeuron(DataInput in, Neuron p) throws IOException
- Throws:
IOException
-
readSynapse
public Synapse readSynapse(DataInput in) throws IOException
- Throws:
IOException
-
writeSynapse
public void writeSynapse(Synapse s, DataOutput out) throws IOException
- Throws:
IOException
-
getNewDocumentId
public int getNewDocumentId()
-
getActiveNeurons
public Collection<Neuron> getActiveNeurons()
-
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)
-
-