som-7.0.1: Self-Organising Maps

Portabilityportable
Stabilityexperimental
Maintaineramy@nualeargais.ie
Safe HaskellSafe-Inferred

Data.Datamining.Clustering.SOMInternal

Description

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

Synopsis

Documentation

data DecayingGaussian a Source

A typical learning function for classifiers. DecayingGaussian r0 rf w0 wf tf returns a bell curve-shaped function. At time zero, the maximum learning rate (applied to the BMU) is r0, and the neighbourhood width is w0. Over time the bell curve shrinks and the learning rate tapers off, until at time tf, the maximum learning rate (applied to the BMU) is rf, and the neighbourhood width is wf. Normally the parameters should be chosen such that:

  • 0 < rf << r0 < 1
  • 0 < wf << w0
  • 0 < tf

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

Constructors

DecayingGaussian a a a a Int 

data StepFunction a Source

A learning function that only updates the BMU and has a constant learning rate.

Constructors

StepFunction a 

data ConstantFunction a Source

A learning function that updates all nodes with the same, constant learning rate. This can be useful for testing.

Constructors

ConstantFunction a 

data SOM f gm k p Source

A Self-Organising Map (SOM).

Although SOM implements GridMap, most users will only need the interface provided by Data.Datamining.Clustering.Classifier. If you chose to use the GridMap functions, please note:

  1. The functions adjust, and adjustWithKey do not increment the counter. You can do so manually with incrementCounter.
  2. The functions map and mapWithKey are not implemented (they just return an error). It would be problematic to implement them because the input SOM and the output SOM would have to have the same Metric type.

Constructors

SOM 

Fields

sGridMap :: gm p
 
sLearningFunction :: f
 
sCounter :: Int
 

Instances

(GridMap gm p, ~ * k (Index (BaseGrid gm p)), Pattern p, Grid (gm p), GridMap gm (Metric p), ~ * k (Index (gm p)), ~ * k (Index (BaseGrid gm (Metric p))), Ord (Metric p), LearningFunction f, ~ * (LearningRate f) (Metric p)) => Classifier (SOM f gm) k p 
Foldable gm => Foldable (SOM f gm k) 
(Foldable gm, GridMap gm p, Grid (BaseGrid gm p)) => GridMap (SOM f gm k) p 
(Eq f, Eq (gm p)) => Eq (SOM f gm k p) 
(Show f, Show (gm p)) => Show (SOM f gm k p) 
Generic (SOM f gm k p) 
Grid (gm p) => Grid (SOM f gm k p) 

toGridMap :: GridMap gm p => SOM f gm k p -> gm pSource

Extracts the grid and current models from the SOM.

adjustNode :: (Pattern p, Grid g, k ~ Index g) => g -> (Int -> Metric p) -> p -> k -> k -> p -> pSource

trainNeighbourhood :: (Pattern p, Grid (gm p), GridMap gm p, Index (BaseGrid gm p) ~ Index (gm p), LearningFunction f, LearningRate f ~ Metric p) => SOM f gm k p -> Index (gm p) -> p -> SOM f gm k pSource

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 :: SOM f gm k p -> SOM f gm k pSource

counter :: SOM f gm k p -> IntSource

setCounter :: Int -> SOM f gm k p -> SOM f gm k pSource

justTrain :: (Ord (Metric p), Pattern p, Grid (gm p), GridMap gm (Metric p), GridMap gm p, Index (BaseGrid gm (Metric p)) ~ Index (gm p), Index (BaseGrid gm p) ~ Index (gm p), LearningFunction f, LearningRate f ~ Metric p) => SOM f gm k p -> p -> SOM f gm k pSource