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 TypeMethodDescriptionvoidvoidfromJSON(org.json.JSONObject json) Deserialize this node and its children from a JSON object and its children.voidgetComponents(List<JPanel> list) Build a Swing Component that represents this Node.doublegetIcon()Set a custom icon for this node.doubledoubledoublegetOutput(int i) Get the sum of output neuron i.doublebooleanisEmpty()booleanvoidscan()Scan all children of this brain to collect all neurons and synapses.voidsetForgettingRate(double v) voidsetHebbianLearningActive(boolean v) voidsetInput(int i, double v) Set the sum of input neuron i.voidsetInputs(int newCount) voidsetLearningRate(double v) voidsetListSize(ListWithEvents<NodePath<Neuron>> list, int newCount) voidsetModulationDegradationRate(double v) voidsetOutputs(int newCount) voidsetSumDecay(double v) org.json.JSONObjecttoJSON()Serialize this node and its children to a JSON object and its children.voidupdate(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:NodeBuild a Swing Component that represents this Node.- Overrides:
getComponentsin classNode- Parameters:
list- the list to add components to.
-
toJSON
public org.json.JSONObject toJSON()Description copied from class:NodeSerialize 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:NodeDeserialize 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()
-