sgd 0.3.4 → 0.3.5
raw patch · 2 files changed
+9/−8 lines, 2 filesdep ~containers
Dependency ranges changed: containers
Files
- sgd.cabal +2/−2
- src/Numeric/SGD/Grad.hs +7/−6
sgd.cabal view
@@ -1,5 +1,5 @@ name: sgd-version: 0.3.4+version: 0.3.5 synopsis: Stochastic gradient descent description: Implementation of a Stochastic Gradient Descent optimization method.@@ -25,7 +25,7 @@ build-depends: base >= 4 && < 5- , containers >= 0.4 && < 0.5+ , containers >= 0.4 && < 0.6 , vector >= 0.10 && < 0.11 , random >= 1.0 && < 1.1 , primitive >= 0.5 && < 0.6
src/Numeric/SGD/Grad.hs view
@@ -32,7 +32,11 @@ import Control.DeepSeq (deepseq) import Control.Monad.Par (spawn_) #endif+#if MIN_VERSION_containers(0,5,0)+import qualified Data.IntMap.Strict as M+#else import qualified Data.IntMap as M+#endif import Numeric.SGD.LogSigned @@ -44,7 +48,9 @@ {-# INLINE insertWith #-} insertWith :: (a -> a -> a) -> M.Key -> a -> M.IntMap a -> M.IntMap a-#if MIN_VERSION_containers(0,4,1)+#if MIN_VERSION_containers(0,5,0)+insertWith = M.insertWith+#elif MIN_VERSION_containers(0,4,1) insertWith = M.insertWith' #else insertWith f k x m = @@ -55,11 +61,6 @@ Just y -> let z = f x y in z `seq` Just z--- insertWith f k x m = case M.lookup k m of--- Just y ->--- let x' = f x y--- in x' `seq` M.insert k x' m--- Nothing -> x `seq` M.insert k x m #endif -- | Add normal-domain double to the gradient at the given position.