new Connection(a, b, weightopt, optionsopt)
Connections help: * a) control the flow information inside of a neural network * b) describe the shape of a neural network * c) ease the use of Evolutionary Algoriths
To facilitate the use of Evolutionary Algoriths, Connections are given Unique Temporal-Structural IDs using the Cantor Pairing Algorithm.
Temporal-Structural IDs: are not only a method of uniquely identifying a connection, they also allow us to identify a) where in the network the connection exists (i.e. between what neurons), and b) when it was "created-ish".
Connection IDs created using the Cantor Pairing Algorithm enable stronger algorithms, i.e. NEAT/HyperNEAT, to create networks of arbitrary sizes/shapes.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a |
Neuron | Group | Neuron(s) on one edge of the connection |
|
b |
Neuron | Group | Neruon(s) on another edge of the connection |
|
weight |
number | Array.<number> |
<optional> |
Weight of connection(s) |
options |
Object |
<optional> |
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | Unique connection ID |
|
a |
Neuron | Group | Side "A" of connection(s) |
|
b |
Neuron | Group | Side "B" of connection(s) |
|
weight |
number | Array.<number> |
<optional> |
Weight of connection(s) |
- Source:
Example
const connection = new Connection(neuron, other) // Connection { a: neuron, b: other }
const connection = new Connection(neuron, other, 0.3) // Connection { a: neuron, b: other, weight: 0.3 }
Methods
(static) uid(fromID, toID) → {number}
Creates a unique structural ID for connection between two neurons using the Cantor Pairing Algorithm.
The Cantor Pairing Algorithm us to a) mathematically, map any two
non-negative integers to a unique positive integer - it even is sensetive to
order (i.e. Connection.uid([2,3]) !== Connection.uid([3,2])
), and b) "AI-ly"
it allows to keep track of unique structural connections across time as a
neural network mutates (i.e. changes "shape").
Parameters:
Name | Type | Description |
---|---|---|
fromID |
number | ID of source neuron |
toID |
number | ID of destination neuron |
- Source:
Returns:
A unique integer ID created using the Cantor Pairing Algorithm
- Type
- number