Portability  nonportable (requires STM) 

Stability  experimental 
Maintainer  gnn.github@gmail.com 
The network of nodes which is build by GSOM consists if nodes of type
and this module contains the definition if this type along with
most of the functions altering or working on them.
Node
 type Neighbours = [TVar Node]
 type Neighbourhood = [(Int, Node)]
 data Node
 type Nodes = [Node]
 isLeaf :: Node > Bool
 isNode :: Node > Bool
 neighbourhood :: Node > Int > STM Neighbourhood
 newWeight :: Node > Int > STM ()
 node :: Coordinates > Input > Neighbours > STM Node
 propagate :: Node > Nodes > STM ()
 putNode :: Node > IO [String]
 boundaryNode :: Node > STM Bool
 unwrappedNeighbours :: Node > STM Nodes
 update :: Input > Double > (Int > Double) > (Int, Node) > STM ()
 updateError :: Node > Input > STM ()
Documentation
type Neighbours = [TVar Node]Source
A node's neighbours are stored in fields of type Neighbours
.
type Neighbourhood = [(Int, Node)]Source
The type of neighbourhoods. Wherever a neighbourhood of a node
is neede, this type should be used.
A Neighbourhood
consits of a list of pairs of nodes and their
discrete grid distance from the source of the neighbourhood.
The source node is the only one with distance 0
while immediate
neighbours get distance one and so on.
The type of nodes of a gsom.
Leaf  They're either Leafs, signalling neighbours of boundary nodes 
Node  or they are actual nodes with a few associated values and a list of neighbouring nodes. 

neighbourhood :: Node > Int > STM NeighbourhoodSource
returns isNode
node
if the given node is a False
and
Leaf
otherwise.
True
Calculates the neighbourhood of the given size of the given node.
A neighbourhood size of 0
means that only the given node will be
an element of the returned set while a size of one will return the
given node and it's immediate neighbours and so on.
It's not very efficient so you shouldn't try big neihbourhood sizes.
The returned neighbourhood always includes node
.
newWeight :: Node > Int > STM ()Source
When a new node is spawned we need to calculate it's new weight vector. If the new node is spawned from parent p in direction d and p has a neighbour n in the direction d' opposite to d then the new weight vector nw is calculated according to the formula:
In all other cases there exists exactly one neighbour of the new node. Let this neighbour be called n and let d' be the direction in which we have to go to reach this neighbour from the new node. Let s then be the child of the new node's parent p in direction d'. The new weights are then calculated according to the formula:

nw = p + n  s
.
node :: Coordinates > Input > Neighbours > STM NodeSource
creates a node with the specified
parameters and initial quantization error of node
id weights neighbours0
.
propagate :: Node > Nodes > STM ()Source
propagates the accumulated error of the given propagate
nodenode
to it's neighbours.
boundaryNode :: Node > STM BoolSource
unwrappedNeighbours :: Node > STM NodesSource
returns the list of neighbours of the
given unwrappedNeighbours
nodenode
.
Note that neighbours is unwrapped, i.e. the returned list hast type
not Nodes
TVar
.
Nodes
update :: Input > Double > (Int > Double) > (Int, Node) > STM ()Source
updates
the weights of the update
input learning_rate kernel neighbourneighbour
according to the formula:
weight > weight + learning_rate * (kernel d) (input  weight)
updateError :: Node > Input > STM ()Source
updateError node input
updates the
of quantizationError
node
.
The new error is just the old error plus the distance of the node
's
weight vector from input
.