neural 0.2.0.0 → 0.3.0.0
raw patch · 10 files changed
+58/−53 lines, 10 filesdep ~JuicyPixelsdep ~MonadRandomdep ~adPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: JuicyPixels, MonadRandom, ad, array, attoparsec, bytestring, deepseq, directory, doctest, filepath, hspec, kan-extensions, lens, neural, pipes, pipes-bytestring, pipes-safe, transformers, typelits-witnesses
API changes (from Hackage documentation)
- Data.Utils.Pipes: fromFile :: (MonadSafe m, MonadIO m) => FilePath -> Producer' ByteString m ()
+ Data.Utils.Pipes: fromFile :: MonadSafe m => FilePath -> Producer' ByteString m ()
- Data.Utils.Stack: runStackT :: Monad m => StackT s m a -> [s] -> m (a, [s])
+ Data.Utils.Stack: runStackT :: StackT s m a -> [s] -> m (a, [s])
- Data.Utils.Vector: sqNorm :: (Num a, KnownNat n) => Vector n a -> a
+ Data.Utils.Vector: sqNorm :: Num a => Vector n a -> a
- Numeric.Neural.Normalization: decode1ofN :: (Enum a, Num b, Ord b, Foldable f) => f b -> a
+ Numeric.Neural.Normalization: decode1ofN :: (Enum a, Ord b, Foldable f) => f b -> a
Files
- .travis.yml +7/−3
- examples/MNIST/MNIST.hs +4/−4
- neural.cabal +31/−31
- src/Data/Utils/Matrix.hs +0/−3
- src/Data/Utils/Pipes.hs +1/−1
- src/Data/Utils/Stack.hs +1/−1
- src/Data/Utils/Vector.hs +8/−6
- src/Numeric/Neural/Model.hs +1/−2
- src/Numeric/Neural/Normalization.hs +1/−1
- stack.yaml +4/−1
.travis.yml view
@@ -28,9 +28,9 @@ include: # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: # https://github.com/hvr/multi-ghc-travis - - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 - compiler: ": #GHC 7.10.3" - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.0.1" + addons: {apt: {packages: [cabal-install-1.22,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS # variable, such as using --stack-yaml to point to a different file. @@ -41,6 +41,10 @@ - env: BUILD=stack ARGS="--resolver lts-5" compiler: ": #stack 7.10.3" addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + + - env: BUILD=stack ARGS="--resolver nightly-2016-06-16" + compiler: ": #stack 8.0.1" + addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}} before_install: # Using compiler above sets CC to an invalid value, so unset it
examples/MNIST/MNIST.hs view
@@ -57,13 +57,13 @@ testImagesFile = "examples" </> "MNIST" </> "t10k-images-idx3-ubyte" <.> "gz" testLabelsFile = "examples" </> "MNIST" </> "t10k-labels-idx1-ubyte" <.> "gz" -bytes :: (MonadSafe m, MonadIO m) => FilePath -> Producer Word8 m () +bytes :: MonadSafe m => FilePath -> Producer Word8 m () bytes f = decompress (fromFile f) >-> toWord8 -labels :: (MonadSafe m, MonadIO m) => FilePath -> Producer Digit m () +labels :: MonadSafe m => FilePath -> Producer Digit m () labels f = bytes f >-> P.drop 8 >-> P.map (toEnum . fromIntegral) -images :: (MonadSafe m, MonadIO m) => FilePath -> Producer Img m () +images :: MonadSafe m => FilePath -> Producer Img m () images f = bytes f >-> P.drop 16 >-> chunks (28 * 28) >-> P.map g where @@ -71,7 +71,7 @@ g xs = let a = A.listArray ((0, 0), (27, 27)) xs in generateImage (\x y -> 255 - a A.! (y, x)) 28 28 -trainSamples, testSamples :: (MonadSafe m, MonadIO m) => Producer Sample m () +trainSamples, testSamples :: MonadSafe m => Producer Sample m () trainSamples = P.zip (images trainImagesFile) (labels trainLabelsFile) testSamples = P.zip (images testImagesFile) (labels testLabelsFile)
neural.cabal view
@@ -1,5 +1,5 @@ name: neural-version: 0.2.0.0+version: 0.3.0.0 cabal-version: >=1.10 build-type: Simple license: MIT@@ -37,7 +37,7 @@ The library is still very much experimental at this point. category: Machine Learning author: Lars Bruenjes-tested-with: GHC ==7.10.3+tested-with: GHC ==7.10.3 GHC ==8.0.1 extra-source-files: .travis.yml .gitignore@@ -52,7 +52,7 @@ source-repository this type: git location: https://github.com/brunjlar/neural.git- tag: 0.1.1.0+ tag: 0.3.0.0 library exposed-modules:@@ -75,30 +75,30 @@ Data.Utils.Vector build-depends: base >=4.7 && <5,- ad >=4.3.2 && <4.4,- array >=0.5.1.0 && <0.6,- bytestring >=0.10.6.0 && <0.11,- deepseq >=1.4.1.1 && <1.5,- directory >=1.2.2.0 && <1.3,- filepath >=1.4.0.0 && <1.5,+ ad >=4.3.2.1 && <4.4,+ array >=0.5.1.1 && <0.6,+ bytestring >=0.10.8.1 && <0.11,+ deepseq >=1.4.2.0 && <1.5,+ directory >=1.2.6.2 && <1.3,+ filepath >=1.4.1.0 && <1.5, ghc-typelits-natnormalise >=0.4.1 && <0.5,- hspec >=2.2.2 && <2.3,- kan-extensions >=4.2.3 && <4.3,- lens ==4.13.*,- MonadRandom >=0.4.2.2 && <0.5,+ hspec >=2.2.3 && <2.3,+ kan-extensions >=5.0.1 && <5.1,+ lens ==4.14.*,+ MonadRandom >=0.4.2.3 && <0.5, monad-par >=0.3.4.7 && <0.4, monad-par-extras >=0.3.3 && <0.4, mtl >=2.2.1 && <2.3, parallel >=3.2.1.0 && <3.3,- pipes >=4.1.8 && <4.2,- pipes-bytestring >=2.1.1 && <2.2,- pipes-safe >=2.2.3 && <2.3,+ pipes >=4.1.9 && <4.2,+ pipes-bytestring >=2.1.3 && <2.2,+ pipes-safe >=2.2.4 && <2.3, profunctors ==5.2.*, reflection >=2.1.2 && <2.2, STMonadTrans >=0.3.3 && <0.4, text >=1.2.2.1 && <1.3,- transformers >=0.4.2.0 && <0.5,- typelits-witnesses >=0.2.0.0 && <0.3,+ transformers >=0.5.2.0 && <0.6,+ typelits-witnesses >=0.2.3.0 && <0.3, vector >=0.11.0.0 && <0.12 default-language: Haskell2010 hs-source-dirs: src@@ -108,8 +108,8 @@ main-is: iris.hs build-depends: base >=4.7 && <5,- attoparsec >=0.13.0.1 && <0.14,- neural >=0.2.0.0 && <0.3,+ attoparsec >=0.13.0.2 && <0.14,+ neural >=0.3.0.0 && <0.4, text >=1.2.2.1 && <1.3 default-language: Haskell2010 hs-source-dirs: examples/iris@@ -119,8 +119,8 @@ main-is: sqrt.hs build-depends: base >=4.7 && <5,- MonadRandom >=0.4.2.2 && <0.5,- neural >=0.2.0.0 && <0.3+ MonadRandom >=0.4.2.3 && <0.5,+ neural >=0.3.0.0 && <0.4 default-language: Haskell2010 hs-source-dirs: examples/sqrt ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fexcess-precision -optc-O3 -optc-ffast-math@@ -129,10 +129,10 @@ main-is: MNIST.hs build-depends: base >=4.7 && <5,- array >=0.5.1.0 && <0.6,- JuicyPixels >=3.2.7 && <3.3,- neural >=0.2.0.0 && <0.3,- pipes >=4.1.8 && <4.2,+ array >=0.5.1.1 && <0.6,+ JuicyPixels >=3.2.7.1 && <3.3,+ neural >=0.3.0.0 && <0.4,+ pipes >=4.1.9 && <4.2, pipes-zlib >=0.4.4 && <0.5 default-language: Haskell2010 hs-source-dirs: examples/MNIST@@ -143,9 +143,9 @@ main-is: Spec.hs build-depends: base >=4.7 && <5,- hspec >=2.2.2 && <2.3,- MonadRandom >=0.4.2.2 && <0.5,- neural >=0.2.0.0 && <0.3+ hspec >=2.2.3 && <2.3,+ MonadRandom >=0.4.2.3 && <0.5,+ neural >=0.3.0.0 && <0.4 default-language: Haskell2010 hs-source-dirs: test other-modules:@@ -157,7 +157,7 @@ main-is: doctest.hs build-depends: base >=4.7 && <5,- doctest >=0.10.1 && <0.11,+ doctest >=0.11.0 && <0.12, Glob >=0.7.5 && <0.8 default-language: Haskell2010 hs-source-dirs: doctest@@ -169,7 +169,7 @@ build-depends: base >=4.7 && <5, criterion >=1.1.1.0 && <1.2,- neural >=0.2.0.0 && <0.3+ neural >=0.3.0.0 && <0.4 default-language: Haskell2010 hs-source-dirs: benchmark ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fexcess-precision -optc-O3 -optc-ffast-math
src/Data/Utils/Matrix.hs view
@@ -119,9 +119,6 @@ -- >>> m !!! (1, 2) -- 3 -- --- >>> m !!! (5, 7) --- *** Exception: Data.Utils.Matrix.!!!: invalid index --- (!!!) :: Matrix m n a -> (Int, Int) -> a m !!! (i, j) = fromMaybe (error "Data.Utils.Matrix.!!!: invalid index") (m !!? (i, j))
src/Data/Utils/Pipes.hs view
@@ -52,7 +52,7 @@ -- | Safely produces 'ByteString's from a file. -- -fromFile :: (MonadSafe m, MonadIO m) => FilePath -> Producer' ByteString m () +fromFile :: MonadSafe m => FilePath -> Producer' ByteString m () fromFile f = P.withFile f ReadMode fromHandle -- | Converts a stream of 'ByteString's into a stream of 'Word8's.
src/Data/Utils/Stack.hs view
@@ -62,7 +62,7 @@ -- | Runs a computation in the @'StackT' s m@ monad. -- -runStackT :: Monad m => StackT s m a -> [s] -> m (a, [s]) +runStackT :: StackT s m a -> [s] -> m (a, [s]) runStackT (StackT m) = runStateT m -- | Evaluates a computation in the @'StackT' s m@ monad.
src/Data/Utils/Vector.hs view
@@ -1,11 +1,16 @@-{-# OPTIONS_HADDOCK show-extensions #-} - +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} +{-# OPTIONS_HADDOCK show-extensions #-} + +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -Wno-redundant-constraints #-} +#endif + {-| Module : Data.Utils.Vector Description : fixed-length vectors @@ -129,9 +134,6 @@ -- >>> cons 'x' nil ! 0 -- 'x' -- --- >>> cons 'x' nil ! 1 --- *** Exception: Data.Utils.Vector.!: invalid index --- (!) :: Vector n a -> Int -> a v ! i = fromMaybe (error "Data.Utils.Vector.!: invalid index") (v !? i) @@ -180,7 +182,7 @@ -- >>> sqNorm (cons 3 (cons 4 nil)) :: Int -- 25 -- -sqNorm :: (Num a, KnownNat n) => Vector n a -> a +sqNorm :: Num a => Vector n a -> a sqNorm v = v <%> v -- | Calculates the /squared/ euclidean distance between two vectors of the same length.
src/Numeric/Neural/Model.hs view
@@ -9,7 +9,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE ImpredicativeTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-| @@ -250,7 +249,7 @@ ws <- r return $ Model (Component ws f r) e i o -errFun :: forall f t a g. (Functor f, Traversable t) +errFun :: forall f t a g. Functor f => (a -> (f Double, Diff g Identity)) -> a -> (forall s. Analytic s => ParamFun s t (f s) (g s))
src/Numeric/Neural/Normalization.hs view
@@ -69,7 +69,7 @@ -- >>> decode1ofN [0.2, 0.3, 0.8 :: Double] :: Ordering -- GT -- -decode1ofN :: (Enum a, Num b, Ord b, Foldable f) => f b -> a +decode1ofN :: (Enum a, Ord b, Foldable f) => f b -> a decode1ofN = toEnum . fst . maximumBy (compare `on` snd) . zip [0..] . toList polyhedron :: Floating a => Int -> [[a]]
stack.yaml view
@@ -1,7 +1,7 @@ # For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) -resolver: lts-5.9 +resolver: nightly-2016-06-16 # Local packages, usually specified by relative directory name packages: @@ -12,8 +12,11 @@ - friday-0.2.2.0 - friday-juicypixels-0.1.1 - natural-transformation-0.3.1 + - pipes-bytestring-2.1.3 + - pipes-group-1.0.5 - pipes-zlib-0.4.4 - ratio-int-0.1.2 + - STMonadTrans-0.3.3 # Override default flag values for local packages and extra-deps flags: {}