Portability | non-portable (requires STM) |
---|---|
Stability | experimental |
Maintainer | gnn.github@gmail.com |
The type
is the type of the network build by the GSOM
algorithm. This type and most of the functions dealing with it are defined
in this module.
Lattice
- type Lattice = Map Coordinates (TVar Node)
- newCentered :: Int -> IO Lattice
- newRandom :: RandomGen g => g -> Int -> IO Lattice
- bmu :: Input -> Lattice -> STM Node
- grow :: Lattice -> Node -> STM (Lattice, Nodes)
- vent :: Lattice -> Node -> Double -> STM (Lattice, [Node])
- nodes :: Lattice -> STM Nodes
- putLattice :: Lattice -> IO String
- putWeights :: Lattice -> IO String
Documentation
type Lattice = Map Coordinates (TVar Node)Source
The lattice type. Since global access to nodes is needed they're
stored in a Data.Map
indexed by their coordinates.
newCentered :: Int -> IO LatticeSource
creates a new minimal lattice where weights
are initialized with all components having the value newNormalized
dimension0.5
the and with
the weight vectors having length dimension
.
newRandom :: RandomGen g => g -> Int -> IO LatticeSource
creates a new minimal lattice where weights are
randomly initialized with values between 0 and 1 using the random number
generator newRandom
g dimensiong
and with the weight vectors having the specified dimension
.
bmu :: Input -> Lattice -> STM NodeSource
returns the best matching unit i.e. the node with
minimal distance to the given input vector.
bmu
input lattice
grow :: Lattice -> Node -> STM (Lattice, Nodes)Source
will create new neighbours for every Leaf
neighbour of the given grow
lattice nodenode
and add the created nodes to lattice
.
It will return the list of spawned nodes and the new lattice containing
every node created in the process of spawning.
vent :: Lattice -> Node -> Double -> STM (Lattice, [Node])Source
will check the accumulated error
of the vent
lattice node growthThresholdnode
against the given growthThreshold
and will do nothing if
the errror value is below the growth threshhold. Otherwise it will either
spawn new nodes or it will propagate the accumulated error value to it's
neighbours, depending on whether the node is a boundary node or not.
If new nodes are spawned they will be added to lattice
and returned as
the second component of the resulting pair.
putLattice :: Lattice -> IO StringSource
putWeights :: Lattice -> IO StringSource