hsgsom-0.2.0: An implementation of the GSOM clustering algorithm.

Portabilitynon-portable (requires STM)



The type Lattice 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.



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

newNormalized dimension creates a new minimal lattice where weights are initialized with all components having the value 0.5 the and with the weight vectors having length dimension.

newRandom :: RandomGen g => g -> Int -> IO LatticeSource

newRandom g dimension creates a new minimal lattice where weights are randomly initialized with values between 0 and 1 using the random number generator g and with the weight vectors having the specified dimension.

bmu :: Input -> Lattice -> STM NodeSource

bmu input lattice returns the best matching unit i.e. the node with minimal distance to the given input vector.

grow :: Lattice -> Node -> STM (Lattice, Nodes)Source

grow lattice node will create new neighbours for every Leaf neighbour of the given node 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

vent lattice node growthThreshold will check the accumulated error of the node 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.

nodes :: Lattice -> STM NodesSource

Returns the nodes stored in lattice.