public class Model extends Object
The model supports parallel processing using a fixed number of threads.
| Modifier and Type | Class and Description |
|---|---|
static class |
Model.Statistic |
| Modifier and Type | Field and Description |
|---|---|
Map<Integer,Provider<? extends AbstractNode>> |
activeProviders |
AtomicInteger |
currentId |
int |
defaultThreadId |
Document[] |
docs |
int[] |
lastCleanup |
int |
numberOfPositions |
Set<Provider<AndNode>> |
numberOfPositionsQueue |
int |
numberOfThreads |
WeakHashMap<Integer,WeakReference<Provider<? extends AbstractNode>>> |
providers |
Model.Statistic |
stat |
SuspensionHook |
suspensionHook |
| Constructor and Description |
|---|
Model()
Creates a model with a single thread.
|
Model(SuspensionHook sh,
int numberOfThreads) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSynapse(Neuron n,
Input input) |
Document |
createDocument(String txt) |
Document |
createDocument(String txt,
int threadId) |
Neuron |
createNeuron() |
Neuron |
createNeuron(String label) |
Neuron |
createNeuron(String label,
boolean isBlocked,
boolean noTraining) |
void |
discardAll()
Discards all unsuspended neurons and logic nodes.
|
Neuron |
initCounterNeuron(Neuron n,
Neuron clockSignal,
boolean dirCS,
Neuron startSignal,
boolean dirSS,
boolean direction)
A counter neuron is used to compute the relational id.
|
Neuron |
initNeuron(Neuron n,
double bias,
Collection<Input> inputs)
Creates a neuron with the given bias.
|
Neuron |
initNeuron(Neuron n,
double bias,
Input... inputs)
Creates a neuron with the given bias.
|
Neuron |
initRelationalNeuron(Neuron n,
Neuron ctn,
Neuron inputSignal,
boolean dirIS)
A relational neuron combines the relational id created by a counter neuron with an input signal.
|
Neuron |
lookupNeuron(int id) |
<P extends Provider<? extends Node>> |
lookupNodeProvider(int id) |
void |
register(Provider p) |
void |
resetFrequency() |
void |
suspendAll()
Suspend all neurons and logic nodes in memory.
|
void |
suspendUnusedNodes(int docId)
Suspend all neurons and logic nodes whose last used document id is lower/older than .
|
void |
unregister(Provider p) |
public int numberOfThreads
public int[] lastCleanup
public Document[] docs
public SuspensionHook suspensionHook
public AtomicInteger currentId
public WeakHashMap<Integer,WeakReference<Provider<? extends AbstractNode>>> providers
public Map<Integer,Provider<? extends AbstractNode>> activeProviders
public Model.Statistic stat
public int defaultThreadId
public volatile int numberOfPositions
public Model()
public Model(SuspensionHook sh, int numberOfThreads)
public Neuron createNeuron()
public Neuron lookupNeuron(int id)
public void resetFrequency()
public void register(Provider p)
public void unregister(Provider p)
public void suspendUnusedNodes(int docId)
docId - public void suspendAll()
public void discardAll()
public Neuron initNeuron(Neuron n, double bias, Collection<Input> inputs)
n - bias - inputs - public Neuron initNeuron(Neuron n, double bias, Input... inputs)
n - bias - inputs - public Neuron initRelationalNeuron(Neuron n, Neuron ctn, Neuron inputSignal, boolean dirIS)
n - ctn - inputSignal - dirIS - public Neuron initCounterNeuron(Neuron n, Neuron clockSignal, boolean dirCS, Neuron startSignal, boolean dirSS, boolean direction)
n - clockSignal - dirCS - The direction of the clock signal.startSignal - dirSS - The direction of the start signal.direction - Copyright © 2017. All rights reserved.