packages feed

Learning 0.0.3 → 0.1.0

raw patch · 3 files changed

+16/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Learning: winnerTakesAll :: (Storable a, Eq a) => Readout -> Vector a -> Classifier a
+ Learning: winnerTakesAll :: (Storable a, Eq a) => Readout -> Vector a -> Matrix Double -> a

Files

ChangeLog.md view
@@ -1,5 +1,12 @@ # Changelog for Learning +## 0.1.0 *February 26th 2018*+  * Change `winnerTakesAll` type signature so that the function can+    be partially applied++## 0.0.3 *February 24th 2018*+  * Fix project to build with stack+ ## 0.0.2 *February 15th 2018*   * Implement confusion matrices   * Write PCA tutorials
Learning.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 17f24c6acefbeb01d1dbaf720f248d2ff7b3d82ff28f368f58a60e25cdc2a4d3+-- hash: 9c0a6f4aaf464a604b168540531ae28760f75b90b75e3f2ac7f98a2e69df0ac6  name:           Learning-version:        0.0.3+version:        0.1.0 synopsis:       The most frequently used machine learning tools description:    Please see the README on Github at <https://github.com/masterdezign/Learning#readme> category:       Machine Learning
src/Learning.hs view
@@ -223,9 +223,10 @@ winnerTakesAll   :: (V.Storable a, Eq a)   => Readout  -- ^ `Readout` matrix-  -> Vector a  -- ^ Vector of possible classes-  -> Classifier a  -- ^ `Classifier`-winnerTakesAll readout klasses = Classifier clf+  -> Vector a  -- ^ Vector of possible classes (labels)+  -> Matrix Double  -- ^ Input matrix+  -> a  -- ^ Label+winnerTakesAll readout klasses = clf   where clf x = let klass = maxIndex $ scores readout x                 in klasses V.! klass @@ -244,7 +245,7 @@ classify'   :: (V.Storable a, Eq a)      => Matrix Double -> Vector a -> Classifier a-classify' = winnerTakesAll+classify' w kl = Classifier (winnerTakesAll w kl) {-# SPECIALIZE classify'   :: Matrix Double -> Vector Int -> Classifier Int   #-}@@ -278,8 +279,7 @@ confusion' tgtlab lab = mp   where     -- Count all possible pairs of labels-    mp = foldr g M.empty $ zip tgtlab lab-    g k mp = M.alter f k mp+    mp = foldr (M.alter f) M.empty $ zip tgtlab lab      f Nothing = Just 1     f (Just x) = Just (x + 1)@@ -347,7 +347,7 @@      predictedLabels = let spc1 = replicate 2 ' '                           spc2 = replicate 4 ' '-                      in spc1 ++ (unwords $ map ((spc2 ++). show) allLabels)+                      in spc1 ++ unwords (map ((spc2 ++). show) allLabels)      -- Tabulate row     fmtRow mp i = unwords (show i: "": line)