com.anji.nn
Class NeuronConnection
java.lang.Object
com.anji.nn.NeuronConnection
- All Implemented Interfaces:
- Connection
- Direct Known Subclasses:
- CacheNeuronConnection
public class NeuronConnection
- extends java.lang.Object
- implements Connection
Connection between neurons.
- Author:
- Philip Tucker
Method Summary |
static void |
appendToXml(java.util.Collection allNeurons,
java.lang.StringBuffer result)
Utility method to convert collection of connections, presumably an entire ANN, to XML. |
long |
cost()
|
protected long |
getId()
for tracking back to chromosome innovation id |
protected Neuron |
getIncomingNode()
|
protected double |
getWeight()
|
boolean |
isRecurrent()
|
double |
read()
|
void |
setId(long l)
|
void |
setWeight(double f)
|
java.lang.String |
toString()
|
java.lang.String |
toXml()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NeuronConnection
public NeuronConnection(Neuron anIncoming)
- Parameters:
anIncoming
- - See Also:
NeuronConnection(Neuron, double)
NeuronConnection
public NeuronConnection(Neuron anIncoming,
double aWeight)
- Create connection with input neuron
anIncoming
and weight aWeight
.
- Parameters:
anIncoming
- aWeight
-
setWeight
public void setWeight(double f)
- Parameters:
f
- new weight
read
public double read()
- Specified by:
read
in interface Connection
- Returns:
- double
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- See Also:
Object.toString()
toXml
public java.lang.String toXml()
- Specified by:
toXml
in interface Connection
- Returns:
- String XML representation of object
setId
public void setId(long l)
- Parameters:
l
- new innovation ID
getId
protected long getId()
- for tracking back to chromosome innovation id
- Returns:
- long ID
getIncomingNode
protected Neuron getIncomingNode()
- Returns:
- Neuron input
getWeight
protected double getWeight()
- Returns:
- double connection weight
appendToXml
public static void appendToXml(java.util.Collection allNeurons,
java.lang.StringBuffer result)
- Utility method to convert collection of connections, presumably an entire ANN, to XML. XML
representation is consistent with NEVT .
- Parameters:
allNeurons
- result
-
isRecurrent
public boolean isRecurrent()
- Returns:
- false
cost
public long cost()
- Specified by:
cost
in interface Connection
- Returns:
- number corresponding to cost of activation in resources
- See Also:
Connection.cost()