Package network.aika.neuron
Class Neuron
- java.lang.Object
-
- network.aika.Provider<INeuron>
-
- network.aika.neuron.Neuron
-
- All Implemented Interfaces:
Comparable<Provider<?>>
public class Neuron extends Provider<INeuron>
TheNeuronclass is a proxy implementation for the real neuron implementation in the classINeuron. Aika uses the provider pattern to store and reload rarely used neurons or logic nodes.- Author:
- Lukas Molzberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNeuron.Builder-
Nested classes/interfaces inherited from class network.aika.Provider
Provider.SuspensionMode
-
-
Field Summary
Fields Modifier and Type Field Description static NeuronMAX_NEURONstatic NeuronMIN_NEURON
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivationaddInput(Document doc, int begin, int end)Propagate an input activation into the network.ActivationaddInput(Document doc, Activation.Builder inputAct)Propagate an input activation into the network.ActivationgetActivation(Document doc, int begin, int end, boolean onlyFinal)Stream<Activation>getActivations(Document doc, boolean onlyFinal)getFinalActivationsis a convenience method to retrieve all activations of the given neuron that are part of the final interpretation.Stream<Activation>getActivations(Document doc, int slot, Position pos, boolean onlyFinal)Collection<Synapse>getActiveInputSynapses()Active input synapses are those synapses that are currently available in the main memory.Collection<Synapse>getActiveOutputSynapses()StringgetLabel()intgetNewSynapseId()PassiveInputFunctiongetPassiveInputFunction()SynapsegetSynapseById(int synapseId)INeuron.TypegetType()static Neuroninit(Document doc, Neuron n, double bias, Collection<Neuron.Builder> inputs)static Neuroninit(Document doc, Neuron n, double bias, Collection<Synapse.Builder> synapseBuilders, Collection<Relation.Builder> relationBuilders)Initializes a neuron with the given bias.static Neuroninit(Document doc, Neuron n, double bias, Neuron.Builder... inputs)Creates a neuron with the given bias.static Neuroninit(Document doc, Neuron n, Neuron.Builder... inputs)static Neuroninit(Neuron n, double bias, Collection<Neuron.Builder> inputs)static Neuroninit(Neuron n, double bias, Collection<Synapse.Builder> synapseBuilders, Collection<Relation.Builder> relationBuilders)Initializes a neuron with the given bias.static Neuroninit(Neuron n, double bias, Neuron.Builder... inputs)Creates a neuron with the given bias.static Neuroninit(Neuron n, Neuron.Builder... inputs)voidregisterSynapseId(int synId)SynapseselectInputSynapse(Neuron inputNeuron, Predicate<Synapse> filter)voidsetActivationFunction(ActivationFunction actF)voidsetOutputText(String outputText)voidsetPassiveInputFunction(PassiveInputFunction f)voidsetType(INeuron.Type t)StringtoString()-
Methods inherited from class network.aika.Provider
compareTo, delete, equals, get, get, get, getId, getIfNotSuspended, getModel, hashCode, isMarkedDeleted, isSuspended, save, suspend
-
-
-
-
Method Detail
-
getLabel
public String getLabel()
-
getType
public INeuron.Type getType()
-
setType
public void setType(INeuron.Type t)
-
setActivationFunction
public void setActivationFunction(ActivationFunction actF)
-
addInput
public Activation addInput(Document doc, int begin, int end)
Propagate an input activation into the network.- Parameters:
doc- The current documentbegin- The range beginend- The range end
-
addInput
public Activation addInput(Document doc, Activation.Builder inputAct)
Propagate an input activation into the network.- Parameters:
doc- The current documentinputAct-
-
init
public static Neuron init(Neuron n, Neuron.Builder... inputs)
-
init
public static Neuron init(Document doc, Neuron n, Neuron.Builder... inputs)
-
init
public static Neuron init(Neuron n, double bias, Neuron.Builder... inputs)
Creates a neuron with the given bias.- Parameters:
n-bias-inputs-- Returns:
-
init
public static Neuron init(Document doc, Neuron n, double bias, Neuron.Builder... inputs)
Creates a neuron with the given bias.- Parameters:
n-bias-inputs-- Returns:
-
init
public static Neuron init(Neuron n, double bias, Collection<Synapse.Builder> synapseBuilders, Collection<Relation.Builder> relationBuilders)
Initializes a neuron with the given bias.- Parameters:
n-bias-synapseBuilders-relationBuilders-- Returns:
-
init
public static Neuron init(Neuron n, double bias, Collection<Neuron.Builder> inputs)
-
init
public static Neuron init(Document doc, Neuron n, double bias, Collection<Synapse.Builder> synapseBuilders, Collection<Relation.Builder> relationBuilders)
Initializes a neuron with the given bias.- Parameters:
n-bias-synapseBuilders-relationBuilders-- Returns:
-
init
public static Neuron init(Document doc, Neuron n, double bias, Collection<Neuron.Builder> inputs)
-
getPassiveInputFunction
public PassiveInputFunction getPassiveInputFunction()
-
setPassiveInputFunction
public void setPassiveInputFunction(PassiveInputFunction f)
-
setOutputText
public void setOutputText(String outputText)
-
getSynapseById
public Synapse getSynapseById(int synapseId)
-
getActivations
public Stream<Activation> getActivations(Document doc, boolean onlyFinal)
getFinalActivationsis a convenience method to retrieve all activations of the given neuron that are part of the final interpretation. Before calling this method, thedoc.process()needs to be called first.getFinalActivationsrequires that thedoc.process()method has been called first.- Parameters:
doc- The current document- Returns:
- A collection with all final activations of this neuron.
-
getActivations
public 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, Predicate<Synapse> filter)
-
getNewSynapseId
public int getNewSynapseId()
-
registerSynapseId
public void registerSynapseId(int synId)
-
getActiveInputSynapses
public Collection<Synapse> getActiveInputSynapses()
Active input synapses are those synapses that are currently available in the main memory.- Returns:
-
getActiveOutputSynapses
public Collection<Synapse> getActiveOutputSynapses()
-
-