packages feed

som 8.0.1 → 8.0.2

raw patch · 5 files changed

+38/−14 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Datamining.Pattern: adjustVectorPreserveLength :: (Num a, Ord a, Eq a) => [a] -> a -> [a] -> [a]

Files

som.cabal view
@@ -1,5 +1,5 @@ Name:              som-Version:           8.0.1+Version:           8.0.2 Stability:         experimental Synopsis:          Self-Organising Maps. Description:       A Kohonen Self-organising Map (SOM) maps input patterns @@ -33,7 +33,7 @@ source-repository this   type:     git   location: https://github.com/mhwombat/som.git-  tag:      8.0.1+  tag:      8.0.2   library
src/Data/Datamining/Clustering/DSOMInternal.hs view
@@ -45,7 +45,7 @@     -- | A function which determines the how quickly the SOM learns.     learningRate :: (x -> x -> x -> x),     -- | A function which compares two patterns and returns a -    --   /non-negative/ numberrepresenting how different the patterns+    --   /non-negative/ number representing how different the patterns     --   are.     --   A result of @0@ indicates that the patterns are identical.     difference :: p -> p -> x,
src/Data/Datamining/Clustering/SOMInternal.hs view
@@ -92,7 +92,7 @@     --   The learning rate should be between zero and one.     learningRate :: t -> d -> x,     -- | A function which compares two patterns and returns a -    --   /non-negative/ numberrepresenting how different the patterns+    --   /non-negative/ number representing how different the patterns     --   are.     --   A result of @0@ indicates that the patterns are identical.     difference :: p -> p -> x,
src/Data/Datamining/Clustering/SSOMInternal.hs view
@@ -58,7 +58,7 @@     --   The learning rate should be between zero and one.     learningRate :: t -> x,     -- | A function which compares two patterns and returns a -    --   /non-negative/ numberrepresenting how different the patterns+    --   /non-negative/ number representing how different the patterns     --   are.     --   A result of @0@ indicates that the patterns are identical.     difference :: p -> p -> x,
src/Data/Datamining/Pattern.hs view
@@ -19,6 +19,7 @@     -- * Numeric vectors as patterns     -- ** Raw vectors     adjustVector,+    adjustVectorPreserveLength,     euclideanDistanceSquared,     magnitudeSquared,     -- ** Normalised vectors@@ -61,18 +62,41 @@ euclideanDistanceSquared :: Num a => [a] -> [a] -> a euclideanDistanceSquared xs ys = magnitudeSquared $ zipWith (-) xs ys --- | @'adjustVector' target amount vector@ adjusts @vector@ to move it---   closer to @target@. The amount of adjustment is controlled by the---   learning rate @r@, which is a number between 0 and 1. Larger values---   of @r@ permit more adjustment. If @r@=1, the result will be---   identical to the @target@. If @amount@=0, the result will be the---   unmodified @pattern@.+-- | @'adjustVector' target amount vector@ adjusts each element of+--   @vector@ to move it closer to the corresponding element of+--   @target@.+--   The amount of adjustment is controlled by the learning rate+--   @amount@, which is a number between 0 and 1.+--   Larger values of @amount@ permit more adjustment.+--   If @amount@=1, the result will be identical to the @target@.+--   If @amount@=0, the result will be the unmodified @pattern@.+--   If @target@ is shorter than @vector@, the result will be the same+--   length as @target@.+--   If @target@ is longer than @vector@, the result will be the same+--   length as @vector@. adjustVector :: (Num a, Ord a, Eq a) => [a] -> a -> [a] -> [a]-adjustVector xs r ys+adjustVector ts r xs   | r < 0     = error "Negative learning rate"   | r > 1     = error "Learning rate > 1"-  | r == 1     = xs-  | otherwise = zipWith (adjustNum' r) xs ys+  | r == 1     = ts+  | otherwise = zipWith (adjustNum' r) ts xs++-- | Same as @'adjustVector'@, except that the result will always be+--   the same length as @vector@.+--   This means that if @target@ is shorter than @vector@, the+--   "leftover" elements of @vector@ will be copied the result,+--   unmodified.+adjustVectorPreserveLength :: (Num a, Ord a, Eq a) => [a] -> a -> [a] -> [a]+adjustVectorPreserveLength ts r xs+  | r < 0     = error "Negative learning rate"+  | r > 1     = error "Learning rate > 1"+  | r == 1     = ts+  | otherwise = avpl ts r xs++avpl :: (Num a, Ord a, Eq a) => [a] -> a -> [a] -> [a]+avpl _ _ [] = []+avpl [] _ x = x+avpl (t:ts) r (x:xs) = (adjustNum' r t x) : (avpl ts r xs)  -- | A vector that has been normalised, i.e., the magnitude of the --   vector = 1.