sgd 0.8.0.2 → 0.8.0.3
raw patch · 2 files changed
+28/−4 lines, 2 filesdep ~hmatrix
Dependency ranges changed: hmatrix
Files
- sgd.cabal +4/−4
- src/Numeric/SGD.hs +24/−0
sgd.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1409d26fec8b15d16a4a06650dc2ce1bf2f51aa72c0e494af222f5c66394ac04+-- hash: 95a0d8b144a4bd5d9864eca97315546b377194d492e5676678cab11540085447 name: sgd-version: 0.8.0.2+version: 0.8.0.3 synopsis: Stochastic gradient descent library description: Import "Numeric.SGD" to use the library. category: Math@@ -52,7 +52,7 @@ , data-default >=0.7 && <0.8 , deepseq >=1.3 && <1.5 , filepath >=1.3 && <1.5- , hmatrix >=0.19 && <0.20+ , hmatrix >=0.19 && <0.21 , logfloat >=0.12 && <0.14 , monad-par >=0.3.4 && <0.4 , mtl >=2.0 && <2.3@@ -82,7 +82,7 @@ , data-default >=0.7 && <0.8 , deepseq >=1.3 && <1.5 , filepath >=1.3 && <1.5- , hmatrix >=0.19 && <0.20+ , hmatrix >=0.19 && <0.21 , logfloat >=0.12 && <0.14 , monad-par >=0.3.4 && <0.4 , mtl >=2.0 && <2.3
src/Numeric/SGD.hs view
@@ -366,6 +366,30 @@ ps -> foldl1' add ps +-- -- | Adapt the gradient function to handle (mini-)batches. The sub-gradients+-- -- of the individual batch elements are evaluated in parallel based on the+-- -- given `Strategy`.+-- batchGradWith+-- :: (ParamSet p)+-- => Strategy p+-- -> (e -> p -> p)+-- -> ([e] -> p -> p)+-- batchGradWith strategy grad xs param =+-- +-- addAll grads+-- +-- where+-- +-- groups = partition numCapabilities xs+-- grads = parMap strategy gradMany groups+-- +-- -- TODO: can we assume here that the group is non-empty?+-- gradMany = foldl1' add . map (\e -> grad e param)+-- +-- addAll [] = param+-- addAll ps = foldl1' add ps++ -- | Adapt the gradient function to handle (mini-)batches. The function -- calculates the individual sub-gradients sequentially. batchGradSeq