som 7.2.0 → 7.2.1
raw patch · 4 files changed
+13/−5 lines, 4 files
Files
- som.cabal +1/−1
- src/Data/Datamining/Clustering/Classifier.hs +3/−1
- src/Data/Datamining/Clustering/DSOMInternal.hs +6/−2
- src/Data/Datamining/Clustering/SOMInternal.hs +3/−1
som.cabal view
@@ -1,5 +1,5 @@ name: som-version: 7.2.0+version: 7.2.1 synopsis: Self-Organising Maps description: A Kohonen Self-organising Map (SOM) maps input patterns onto a regular grid (usually two-dimensional) where each
src/Data/Datamining/Clustering/Classifier.hs view
@@ -40,7 +40,9 @@ -- | @classify c target@ returns the index of the node in @c@ -- whose model best matches the @target@. classify :: (Pattern p, Ord v, v ~ Metric p) => c k p -> p -> k- classify c p = fst . minimumBy (comparing snd) $ differences c p+ classify c p = f $ differences c p+ where f [] = error "classifier has no models"+ f xs = fst $ minimumBy (comparing snd) xs -- | @'train' c target@ returns a modified copy -- of the classifier @c@ that has partially learned the @target@.
src/Data/Datamining/Clustering/DSOMInternal.hs view
@@ -115,7 +115,9 @@ DSOM gm t p -> p -> DSOM gm (G.Index (gm p)) p justTrain s p = trainNeighbourhood s bmu p where ds = GM.toList . GM.map (p `difference`) $ sGridMap s- bmu = fst $ minimumBy (comparing snd) ds+ bmu = f ds+ f [] = error "DSOM has no models"+ f xs = fst $ minimumBy (comparing snd) xs instance (GM.GridMap gm p, k ~ G.Index (GM.BaseGrid gm p), Pattern p,@@ -130,7 +132,9 @@ trainBatch s = foldl' justTrain s reportAndTrain s p = (bmu, ds, s') where ds = differences s p- bmu = fst $ minimumBy (comparing snd) ds+ bmu = f ds+ f [] = error "DSOM has no models"+ f xs = fst $ minimumBy (comparing snd) xs s' = trainNeighbourhood s bmu p
src/Data/Datamining/Clustering/SOMInternal.hs view
@@ -183,7 +183,9 @@ SOM f t gm k p -> p -> SOM f t gm k p justTrain s p = trainNeighbourhood s bmu p where ds = GM.toList . GM.map (p `difference`) $ gridMap s- bmu = fst $ minimumBy (comparing snd) ds+ bmu = f ds+ f [] = error "SOM has no models"+ f xs = fst $ minimumBy (comparing snd) xs instance (GM.GridMap gm p, k ~ G.Index (GM.BaseGrid gm p), Pattern p,