Class Brain
java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.neuralnetwork.Brain
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ListWithEvents
<NodePath<Neuron>> final ListWithEvents
<NodePath<Neuron>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
fromJSON
(org.json.JSONObject json) Deserialize this node and its children from a JSON object and its children.void
getComponents
(List<JPanel> list) Build a Swing Component that represents this Node.double
getIcon()
Set a custom icon for this node.double
double
double
getOutput
(int i) Get the sum of output neuron i.double
boolean
isEmpty()
boolean
void
scan()
Scan all children of this brain to collect all neurons and synapses.void
setForgettingRate
(double v) void
setHebbianLearningActive
(boolean v) void
setInput
(int i, double v) Set the sum of input neuron i.void
setInputs
(int newCount) void
setLearningRate
(double v) void
setListSize
(ListWithEvents<NodePath<Neuron>> list, int newCount) void
setModulationDegradationRate
(double v) void
setOutputs
(int newCount) void
setSumDecay
(double v) org.json.JSONObject
toJSON()
Serialize this node and its children to a JSON object and its children.void
update
(double dt) Called every frame.Methods inherited from class com.marginallyclever.ro3.node.Node
addAttachListener, addChild, addChild, addDetachListener, addReadyListener, addRenameListener, findByPath, findChild, findChild, findFirstChild, findFirstSibling, findNodeByID, findParent, findParent, getAbsolutePath, getChildren, getName, getParent, getRootNode, getUniqueID, hasParent, isNameUsedBySibling, removeAttachListener, removeChild, removeDetachListener, removeReadyListener, removeRenameListener, setName, witnessProtection
-
Field Details
-
inputs
-
outputs
-
-
Constructor Details
-
Brain
public Brain() -
Brain
-
-
Method Details
-
update
-
getIcon
-
scan
public void scan()Scan all children of this brain to collect all neurons and synapses. Updates the bounding box of the brain, as well as the neurons and synapses lists -
isEmpty
public boolean isEmpty() -
getNeurons
-
getSynapses
-
getComponents
Description copied from class:Node
Build a Swing Component that represents this Node.- Overrides:
getComponents
in classNode
- Parameters:
list
- the list to add components to.
-
toJSON
public org.json.JSONObject toJSON()Description copied from class:Node
Serialize this node and its children to a JSON object and its children. Classes that override this method should call super.toJSON() first, then add to the object returned. -
fromJSON
public void fromJSON(org.json.JSONObject json) Description copied from class:Node
Deserialize this node and its children from a JSON object and its children. Classes that override this method should call super.fromJSON(). When they do it will trigger the creation of child nodes. The child nodes will then call their own fromJSON() methods. -
setInputs
public void setInputs(int newCount) -
setOutputs
public void setOutputs(int newCount) -
setListSize
-
getOutput
public double getOutput(int i) Get the sum of output neuron i.- Parameters:
i
- the index of the neuron- Returns:
- the sum of the neuron or zero if the neuron is not found.
- Throws:
InvalidParameterException
- if the index is out of range
-
setInput
public void setInput(int i, double v) Set the sum of input neuron i.- Parameters:
i
- the index of the neuronv
- the new sum- Throws:
InvalidParameterException
- if the index is out of range
-
decaySums
public void decaySums() -
getSumDecay
public double getSumDecay() -
setSumDecay
public void setSumDecay(double v) -
getLearningRate
public double getLearningRate() -
setLearningRate
public void setLearningRate(double v) -
getForgettingRate
public double getForgettingRate() -
setForgettingRate
public void setForgettingRate(double v) -
isHebbianLearningActive
public boolean isHebbianLearningActive() -
setHebbianLearningActive
public void setHebbianLearningActive(boolean v) -
setModulationDegradationRate
public void setModulationDegradationRate(double v) -
getModulationDegradationRate
public double getModulationDegradationRate()
-