Portability | portable |
---|---|

Stability | experimental |

Maintainer | amy@nualeargais.ie |

Safe Haskell | Safe-Inferred |

Tools for identifying patterns in data.

- class Classifier c k p where
- toList :: c k p -> [(k, p)]
- numModels :: c k p -> Int
- models :: c k p -> [p]
- differences :: (Pattern p, v ~ Metric p) => c k p -> p -> [(k, v)]
- classify :: (Pattern p, Ord v, v ~ Metric p) => c k p -> p -> k
- train :: (Ord v, v ~ Metric p) => c k p -> p -> c k p
- trainBatch :: c k p -> [p] -> c k p
- classifyAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> (k, c k p)
- diffAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> ([(k, v)], c k p)
- reportAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> (k, [(k, v)], c k p)

# Documentation

class Classifier c k p whereSource

A machine which learns to classify input patterns.
Minimal complete definition: `trainBatch`

, `reportAndTrain`

.

toList :: c k p -> [(k, p)]Source

Returns a list of index/model pairs.

numModels :: c k p -> IntSource

Returns the number of models this classifier can learn.

Returns the current models of the classifier.

differences :: (Pattern p, v ~ Metric p) => c k p -> p -> [(k, v)]Source

returns the indices of all nodes in
`differences`

c target`c`

, paired with the difference between `target`

and the
node's model.

classify :: (Pattern p, Ord v, v ~ Metric p) => c k p -> p -> kSource

`classify c target`

returns the index of the node in `c`

whose model best matches the `target`

.

train :: (Ord v, v ~ Metric p) => c k p -> p -> c k pSource

returns a modified copy
of the classifier `train`

c target`c`

that has partially learned the `target`

.

trainBatch :: c k p -> [p] -> c k pSource

returns a modified copy
of the classifier `trainBatch`

c targets`c`

that has partially learned the `targets`

.

classifyAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> (k, c k p)Source

returns a tuple containing the
index of the node in `classifyAndTrain`

c target`c`

whose model best matches the input
`target`

, and a modified copy of the classifier `c`

that has
partially learned the `target`

. Invoking `classifyAndTrain c p`

may be faster than invoking `(p `

, but
they
should give identical results.
`classify`

c, train c p)

diffAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> ([(k, v)], c k p)Source

returns a tuple containing:
1. The indices of all nodes in `diffAndTrain`

c target`c`

, paired with the difference
between `target`

and the node's model
2. A modified copy of the classifier `c`

that has partially
learned the `target`

.
Invoking `diffAndTrain c p`

may be faster than invoking
`(p `

, but they should give identical
results.
`diff`

c, train c p)

reportAndTrain :: (Ord v, v ~ Metric p) => c k p -> p -> (k, [(k, v)], c k p)Source

returns a tuple containing:
1. The index of the node in `reportAndTrain`

c f target`c`

whose model best matches the
input `target`

2. The indices of all nodes in `c`

, paired with the difference
between `target`

and the node's model
3. A modified copy of the classifier `c`

that has partially
learned the `target`

Invoking `diffAndTrain c p`

may be faster than invoking
`(p `

, but they should give identical
results.
`diff`

c, train c p)

(GridMap gm p, ~ * k (Index (BaseGrid gm p)), Pattern p, FiniteGrid (gm p), GridMap gm (Metric p), ~ * k (Index (gm p)), ~ * k (Index (BaseGrid gm (Metric p))), Ord k, Ord (Metric p), Num (Metric p), Fractional (Metric p)) => Classifier (DSOM gm) k p | |

(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, ~ * (Metric p) (LearningRate f), Num (LearningRate f), Integral t) => Classifier (SOM f t gm) k p |