| Modifier and Type | Field and Description |
|---|---|
protected Function |
activationFn
The activation function.
|
protected java.lang.String |
name
Name for this BrainPart.
|
static long |
NO_ID
Indicates a new brain part without ID.
|
protected double |
weight
The weight/bias of this part.
|
| Constructor and Description |
|---|
BrainPart() |
| Modifier and Type | Method and Description |
|---|---|
void |
addGradient(double value)
Adds a value to the gradient.
|
void |
addToWeight(double deltaWeight)
Adds the given value to the weight/bias.
|
void |
calculate()
Calculate the current state of this brain part.
|
BrainPart |
clone()
Returns a shallow copy.
|
void |
fromXML(org.jdom2.Element element)
Reads attributes from XML tree.
|
double |
getAccu()
Returns accu value.
|
Function |
getActivationFn()
Return the current activation function.
|
double |
getGradient()
Returns gradient information.
|
long |
getID()
Returns the ID.
|
double |
getLastGradient()
Returns the last gradient information.
|
java.lang.String |
getName()
Return the name of this BrainPart.
|
static long |
getUniqueID()
Returns a unique ID for a brain part.
|
double |
getWeight()
Returns the weight of this link.
|
boolean |
isTrainable()
Returns the status.
|
void |
randomize()
Randomizes the weight/bias value within [-0.1, 0.1).
|
void |
randomize(double minValue,
double maxValue)
Randomizes the weight/bias value within the given bounds.
|
void |
reset()
Resets internal attributes.
|
void |
setAccu(double value)
Sets accu value.
|
void |
setActivationFn(Function activationFn)
Set the brain part's activation function.
|
void |
setGradient(double gradient)
Sets gradient information.
|
void |
setID(long id)
Sets the ID.
|
void |
setLastGradient(double lastGradient)
Remembers the last gradient information.
|
void |
setName(java.lang.String name)
Set the name of this BrainPart.
|
void |
setTrainable(boolean trainable)
Sets status.
|
void |
setWeight(double weight)
Sets the weight/bias of this part.
|
java.lang.String |
toString()
Returns the name of the BrainPart.
|
org.jdom2.Element |
toXML(org.jdom2.Element element)
Writes attributes to XML tree.
|
public static final long NO_ID
protected java.lang.String name
protected double weight
protected Function activationFn
public void calculate()
public void reset()
public static long getUniqueID()
public boolean isTrainable()
public double getWeight()
public void setWeight(double weight)
addToWeight(double).weight - the weight valuepublic void addToWeight(double deltaWeight)
deltaWeight - the value to be addedpublic void setTrainable(boolean trainable)
trainable - true, if trainablepublic Function getActivationFn()
public void setActivationFn(Function activationFn)
Function.create(String) to create a Function instance from a name string.public double getGradient()
public void setGradient(double gradient)
gradient - some gradient valuepublic void addGradient(double value)
value - a valuepublic double getLastGradient()
public void setLastGradient(double lastGradient)
lastGradient - the last gradient valuepublic double getAccu()
public void setAccu(double value)
value - some valuepublic void randomize()
public void randomize(double minValue,
double maxValue)
minValue - lower boundmaxValue - upper boundpublic org.jdom2.Element toXML(org.jdom2.Element element)
public void fromXML(org.jdom2.Element element)
public BrainPart clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
public void setName(java.lang.String name)
public long getID()
public void setID(long id)
id - a unique ID