public class Link extends BrainPart
| Modifier and Type | Field and Description |
|---|---|
protected Neuron |
sink
The destination / sink unit.
|
protected Neuron |
source
The source unit.
|
protected double |
value
The link value.
|
activationFn, name, NO_ID, weight| Constructor and Description |
|---|
Link()
Creates a directed link.
|
Link(double weight)
Creates a dangling link with the given weight.
|
Link(Neuron source,
Neuron sink,
double weight)
Creates a new link from source to sink with the given weight.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearSink()
Sets the sink to null.
|
void |
clearSource()
Sets the source to null.
|
Link |
clone()
Returns a semi-deep copy of this object.
|
void |
disconnect()
Disconnect this link, i.e.
|
void |
fromXML(org.jdom2.Element element,
NeuralNet net)
Reads attributes from XML tree.
|
Neuron |
getOtherNeuron(Neuron neuron)
Get the other neuron of the link.
|
Neuron |
getSink()
Returns the sink neuron.
|
Neuron |
getSource()
Returns the source neuron.
|
double |
getValue() |
boolean |
isDangling()
Indicates a dangling link, i.e., a link not connecting neurons.
|
boolean |
isDirected() |
boolean |
isInputOf(Neuron n)
Indicates if this link is an input to the given neuron.
|
boolean |
isOutputOf(Neuron n)
Indicates if this link is an output of the given neuron.
|
void |
propagate()
Propagates the output of the source neuron over the link.
|
void |
replaceFrom(Link oldLink)
Replaces the given old link with this new link, i.e.
|
void |
replaceNeuron(Neuron oldNeuron,
Neuron newNeuron)
Replace the given old neuron with a new neuron.
|
void |
setDirected(boolean directed)
Sets the direction flag.
|
Neuron |
setSink(Neuron sink)
Sets the link's sink neuron.
|
Neuron |
setSource(Neuron source)
Sets the link's source neuron.
|
void |
setValue(double value) |
java.lang.String |
toString()
Return a string
|
org.jdom2.Element |
toXML(org.jdom2.Element element)
Writes attributes to XML tree.
|
addGradient, addToWeight, calculate, fromXML, getAccu, getActivationFn, getGradient, getID, getLastGradient, getName, getUniqueID, getWeight, isTrainable, randomize, randomize, reset, setAccu, setActivationFn, setGradient, setID, setLastGradient, setName, setTrainable, setWeightprotected Neuron source
protected Neuron sink
protected double value
public Link()
public Link(double weight)
weight - the weight valuepublic Link clone()
public Neuron getSource()
public Neuron setSource(Neuron source)
source - the new source of the link, may be nullpublic void clearSource()
public Neuron getSink()
public Neuron setSink(Neuron sink)
sink - the new sink of the link, may be nullpublic void clearSink()
public boolean isDangling()
public double getValue()
public void setValue(double value)
value - New value of property value.public boolean isDirected()
public void setDirected(boolean directed)
directed - true, otherwise both directionspublic void disconnect()
NOTE: You also need to remove the Link object itself from the Neural Network; better
use NeuralNet.removeLink(Link) instead.
public void propagate()
public Neuron getOtherNeuron(Neuron neuron)
neuron - the one neuronpublic void replaceNeuron(Neuron oldNeuron, Neuron newNeuron)
oldNeuron - The neuron that is to be replaced.newNeuron - The neuron that should be put into place instead of the old neuron.public void replaceFrom(Link oldLink)
public boolean isInputOf(Neuron n)
n - a neuronpublic boolean isOutputOf(Neuron n)
n - a neuronpublic org.jdom2.Element toXML(org.jdom2.Element element)
public void fromXML(org.jdom2.Element element,
NeuralNet net)
element - an XML elementnet - the associated net