Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Simple feed-forward deep learning
Synopsis
- type (--*) p q = q :.: p
- scaleV :: (Functor a, Num s) => s -> Unop (a s)
- (*^) :: (Functor a, Num s) => s -> Unop (a s)
- negateV :: (Functor a, Num s) => Unop (a s)
- (^-^) :: (Zip a, Num s) => Binop (a s)
- (^/) :: (Functor a, Fractional s) => a s -> s -> a s
- normalize :: (Foldable a, Functor a, Fractional s, Additive s) => Unop (a s)
- dotV :: (Foldable a, Zip a, Additive s, Num s) => a s -> a s -> s
- (<.>) :: (Foldable a, Zip a, Additive s, Num s) => a s -> a s -> s
- outerV :: (Functor a, Functor b, Num s) => a s -> b s -> a (b s)
- (>.<) :: (Functor a, Functor b, Num s) => a s -> b s -> a (b s)
- linear :: (Foldable a, Zip a, Functor b, Additive s, Num s) => (a --* b) s -> a s -> b s
- type Bump h = h :*: Par1
- bump :: Num s => a s -> Bump a s
- type (--+) a b = Bump a --* b
- affine :: (Foldable a, Zip a, Functor b, Additive s, Num s) => (a --+ b) s -> a s -> b s
- normSqr :: (Foldable n, Zip n, Additive s, Num s) => n s -> s
- distSqr :: (Foldable n, Zip n, Additive s, Num s) => n s -> n s -> s
- relus :: (Functor f, Ord a, Num a) => Unop (f a)
- affRelu :: (Foldable a, Zip a, Functor b, Ord s, Additive s, Num s) => (a --+ b) s -> a s -> b s
- logistics :: (Functor f, Floating a) => Unop (f a)
- affLog :: (Foldable a, Zip a, Functor b, Floating s, Additive s) => (a --+ b) s -> a s -> b s
- errSqr :: (Foldable b, Zip b, Additive s, Num s) => (a s :* b s) -> (a s -> b s) -> s
- errSqrSampled :: (Foldable b, Zip b, Additive s, Num s) => (p s -> a s -> b s) -> (a s :* b s) -> p s -> s
- errGrad :: (Foldable b, Zip b, Additive s, Num s) => (p s -> a s -> b s) -> (a s :* b s) -> Unop (p s)
- (@.) :: (q s -> b -> c) -> (p s -> a -> b) -> (q :*: p) s -> a -> c
- step :: forall s p a b. (Foldable b, Zip b, Functor p, Zip p, Additive1 p, Additive s, Num s) => (p s -> a s -> b s) -> s -> (a s :* b s) -> Unop (p s)
- steps :: (Foldable b, Zip b, Zip p, Additive1 p, Functor f, Foldable f, Additive s, Num s) => (p s -> a s -> b s) -> s -> f (a s :* b s) -> Unop (p s)
- trainNTimes :: (Foldable b, Zip b, Zip p, Additive1 p, Functor f, Foldable f, Additive s, Num s) => Int -> s -> (p s -> a s -> b s) -> p s -> f (a s :* b s) -> [p s]
- err1 :: (R -> R) -> (R :* R) -> R
- err1Grad :: (p -> R -> R) -> (R :* R) -> Unop p
- type (-->) a b s = a s -> b s
- lr1 :: (C2 Foldable a b, Zip a, Functor b) => (a --+ b) R -> (a --> b) R
- lr2 :: (C2 Foldable a b, C2 Zip a b, C2 Functor b c) => ((b --+ c) :*: (a --+ b)) R -> (a --> c) R
- lr3 :: (C3 Foldable a b c, C3 Zip a b c, C3 Functor b c d) => ((c --+ d) :*: ((b --+ c) :*: (a --+ b))) R -> (a --> d) R
- lr3' :: (C3 Foldable a b c, C3 Zip a b c, C3 Functor b c d) => ((c --+ d) :*: ((b --+ c) :*: (a --+ b))) R -> (a --> d) R
Documentation
(^/) :: (Functor a, Fractional s) => a s -> s -> a s infixl 7 Source #
outerV :: (Functor a, Functor b, Num s) => a s -> b s -> a (b s) Source #
Outer product. (Do we want this order of functor composition?)
(>.<) :: (Functor a, Functor b, Num s) => a s -> b s -> a (b s) infixl 7 Source #
Outer product. (Do we want this order of functor composition?)
linear :: (Foldable a, Zip a, Functor b, Additive s, Num s) => (a --* b) s -> a s -> b s Source #
Apply a linear map
affine :: (Foldable a, Zip a, Functor b, Additive s, Num s) => (a --+ b) s -> a s -> b s Source #
Affine application
affRelu :: (Foldable a, Zip a, Functor b, Ord s, Additive s, Num s) => (a --+ b) s -> a s -> b s Source #
Affine followed by RELUs.
affLog :: (Foldable a, Zip a, Functor b, Floating s, Additive s) => (a --+ b) s -> a s -> b s Source #
Affine followed by logistics.
errSqrSampled :: (Foldable b, Zip b, Additive s, Num s) => (p s -> a s -> b s) -> (a s :* b s) -> p s -> s Source #
errGrad :: (Foldable b, Zip b, Additive s, Num s) => (p s -> a s -> b s) -> (a s :* b s) -> Unop (p s) Source #
step :: forall s p a b. (Foldable b, Zip b, Functor p, Zip p, Additive1 p, Additive s, Num s) => (p s -> a s -> b s) -> s -> (a s :* b s) -> Unop (p s) Source #
steps :: (Foldable b, Zip b, Zip p, Additive1 p, Functor f, Foldable f, Additive s, Num s) => (p s -> a s -> b s) -> s -> f (a s :* b s) -> Unop (p s) Source #
:: (Foldable b, Zip b, Zip p, Additive1 p, Functor f, Foldable f, Additive s, Num s) | |
=> Int | number of epochs |
-> s | learning rate |
-> (p s -> a s -> b s) | The "network" just converts a set of parameters into a function from input to output functors. |
-> p s | initial guess for learnable parameters |
-> f (a s :* b s) | the training pairs |
-> [p s] | initial parameters + those after each training epoch trainNTimes n rate net ps prs = take (n+1) $ iterate (steps net rate prs) ps |
Train a network on several epochs of the training data, keeping track of its parameters after each.
lr2 :: (C2 Foldable a b, C2 Zip a b, C2 Functor b c) => ((b --+ c) :*: (a --+ b)) R -> (a --> c) R Source #