Package network.aika.neuron
Class INeuron
- java.lang.Object
-
- network.aika.AbstractNode<Neuron>
-
- network.aika.neuron.INeuron
-
- All Implemented Interfaces:
Comparable<INeuron>,Writable
public class INeuron extends AbstractNode<Neuron> implements Comparable<INeuron>
TheINeuronclass represents a internal neuron implementation in Aikas neural network and is connected to other neurons through input synapses and output synapses. The activation value of a neuron is calculated by computing the weighted sum (input act. value * synapse weight) of the input synapses, adding the bias to it and sending the resulting value through a transfer function (the upper part of tanh).The neuron does not store its activationsBySlotAndPosition by itself. The activation objects are stored within the logic nodes. To access the activationsBySlotAndPosition of this neuron simply use the member variable
nodeor use the methodgetFinalActivations(Document doc)to ge the final activationsBySlotAndPosition of this neuron.- Author:
- Lukas Molzberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classINeuron.SynapseSummarystatic classINeuron.Type
-
Field Summary
Fields Modifier and Type Field Description static INeuronMAX_NEURONstatic INeuronMIN_NEURONstatic doubleWEIGHT_TOLERANCE-
Fields inherited from class network.aika.AbstractNode
lastUsedDocumentId, modified, provider
-
-
Constructor Summary
Constructors Constructor Description INeuron(Model m, String label, String outputText, INeuron.Type type, ActivationFunction actF)INeuron(Model m, String label, INeuron.Type type, ActivationFunction actF)INeuron(Neuron p)
-
Method Summary
-
Methods inherited from class network.aika.AbstractNode
getModelLabels, getProvider, read, setModified
-
-
-
-
Constructor Detail
-
INeuron
public INeuron(Neuron p)
-
INeuron
public INeuron(Model m, String label, INeuron.Type type, ActivationFunction actF)
-
INeuron
public INeuron(Model m, String label, String outputText, INeuron.Type type, ActivationFunction actF)
-
-
Method Detail
-
getId
public Integer getId()
-
getLabel
public String getLabel()
- Overrides:
getLabelin classAbstractNode<Neuron>
-
getCustomData
public Writable getCustomData()
-
setCustomData
public void setCustomData(Writable customData)
-
getType
public INeuron.Type getType()
-
setType
public void setType(INeuron.Type t)
-
getSynapseSummary
public INeuron.SynapseSummary getSynapseSummary()
-
getInputSynapses
public Collection<Synapse> getInputSynapses()
-
addModelLabel
public void addModelLabel(String modelLabel)
- Overrides:
addModelLabelin classAbstractNode<Neuron>
-
getMaxInputSynapse
public Synapse getMaxInputSynapse(Synapse.State state)
-
getOutputSynapses
public Collection<Synapse> getOutputSynapses()
-
getPassiveInputSynapses
public Collection<Synapse> getPassiveInputSynapses()
-
getActivationFunction
public ActivationFunction getActivationFunction()
-
setActivationFunction
public void setActivationFunction(ActivationFunction actF)
-
getActivations
public Stream<Activation> getActivations(Document doc)
-
isEmpty
public boolean isEmpty(Document doc)
-
size
public int size(Document doc)
-
clearActivations
public void clearActivations(Document doc)
-
getActivations
public Stream<Activation> getActivations(Document doc, int slot, Position pos, boolean onlyFinal)
-
clearActivations
public void clearActivations()
-
clearActivations
public void clearActivations(int threadId)
-
getModel
public Model getModel()
-
getActivations
public Stream<Activation> getActivations(Document doc, int fromSlot, Position fromPos, boolean fromInclusive, int toSlot, Position toPos, boolean toInclusive)
-
getActivations
public Stream<Activation> getActivations(Document doc, boolean onlyFinal)
-
getActivations
public Collection<Activation> getActivations(Document doc, SortedMap<Integer,Position> slots)
-
setOutputText
public void setOutputText(String outputText)
-
getOutputText
public String getOutputText()
-
addInput
public Activation addInput(Document doc, Activation.Builder input)
Propagate an input activation into the network.- Parameters:
doc- The current documentinput-
-
createActivation
protected Activation createActivation(Document doc, Map<Integer,Position> slots)
-
getTotalBias
public double getTotalBias(Synapse.State state)
-
commit
public void commit(Collection<Synapse> modifiedSynapses)
-
remove
public void remove()
-
getNewSynapseId
public int getNewSynapseId()
-
registerSynapseId
public void registerSynapseId(Integer synId)
-
propagate
public void propagate(Activation act)
-
compareTo
public int compareTo(INeuron n)
- Specified by:
compareToin interfaceComparable<INeuron>
-
write
public void write(DataOutput out) throws IOException
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Overrides:
writein classAbstractNode<Neuron>- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException
-
readFields
public void readFields(DataInput in, Model m) throws IOException
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Overrides:
readFieldsin classAbstractNode<Neuron>- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException
-
suspend
public void suspend()
- Overrides:
suspendin classAbstractNode<Neuron>
-
reactivate
public void reactivate()
- Overrides:
reactivatein classAbstractNode<Neuron>
-
delete
public void delete(Set<String> modelLabels)
- Specified by:
deletein classAbstractNode<Neuron>
-
isNeuron
public boolean isNeuron()
- Specified by:
isNeuronin classAbstractNode<Neuron>
-
setBias
public void setBias(double b)
-
updateBiasDelta
public void updateBiasDelta(double biasDelta)
-
getBias
public double getBias()
-
getNewBias
public double getNewBias()
-
getBiasDelta
public double getBiasDelta()
-
register
public void register(Activation act)
-
isPassiveInputNeuron
public boolean isPassiveInputNeuron()
-
registerPassiveInputSynapse
public void registerPassiveInputSynapse(Synapse s)
-
toDetailedString
protected String toDetailedString()
-
typeToString
public String typeToString()
-
toStringWithSynapses
public String toStringWithSynapses()
-
-