som-7.3.0: Self-Organising Maps.

Copyright(c) Amy de Buitléir 2012-2014
Safe HaskellSafe-Inferred



A module containing private SSOM internals. Most developers should use SSOM instead. This module is subject to change without notice.



class LearningFunction f where Source

A function used to adjust the models in a classifier.

Associated Types

type LearningRate f Source


rate :: f -> LearningRate f -> LearningRate f Source

rate f t returns the learning rate for a node. The parameter f is the learning function. The parameter t indicates how many patterns (or pattern batches) have previously been presented to the classifier. Typically this is used to make the learning rate decay over time. The output is the learning rate for that node (the amount by which the node's model should be updated to match the target). The learning rate should be between zero and one.


data Gaussian a Source

A typical learning function for classifiers. Gaussian r0 rf tf returns a gaussian function. At time zero, the learning rate is r0. Over time the learning rate tapers off, until at time tf, the learning rate is rf. Normally the parameters should be chosen such that:

  • 0 < rf << r0 < 1
  • 0 < tf

where << means "is much smaller than" (not the Haskell << operator!)


Gaussian a a a 


Eq a => Eq (Gaussian a) 
Show a => Show (Gaussian a) 
Generic (Gaussian a) 
(Floating a, Fractional a, Num a) => LearningFunction (Gaussian a) 
type Rep (Gaussian a) 
type LearningRate (Gaussian a) = a 

data SSOM f t k p Source

A Simplified Self-Organising Map (SSOM).




sMap :: Map k p

Maps patterns to nodes.

learningFunction :: f

The function used to update the nodes.

counter :: t

A counter used as a "time" parameter. If you create the SSOM with a counter value 0, and don't directly modify it, then the counter will represent the number of patterns that this SSOM has classified.


(Pattern p, Ord (Metric p), LearningFunction f, (~) * (Metric p) (LearningRate f), Num (LearningRate f), Ord k, Integral t) => Classifier (SSOM f t) k p 
(Eq f, Eq t, Eq k, Eq p) => Eq (SSOM f t k p) 
(Show f, Show t, Show k, Show p) => Show (SSOM f t k p) 
Generic (SSOM f t k p) 
type Rep (SSOM f t k p) 

toMap :: SSOM f t k p -> Map k p Source

Extracts the current models from the SSOM. A synonym for sMap.

trainNode :: (Pattern p, LearningFunction f, Metric p ~ LearningRate f, Num (LearningRate f), Ord k, Integral t) => SSOM f t k p -> k -> p -> SSOM f t k p Source

Trains the specified node and the neighbourood around it to better match a target. Most users should use train, which automatically determines the BMU and trains it and its neighbourhood.

incrementCounter :: Num t => SSOM f t k p -> SSOM f t k p Source

justTrain :: (Ord (Metric p), Pattern p, LearningFunction f, Metric p ~ LearningRate f, Num (LearningRate f), Ord k, Integral t) => SSOM f t k p -> p -> SSOM f t k p Source