Copyright | (c) David Banas 2018 |
---|---|
License | BSD-3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | ? |
Safe Haskell | None |
Language | Haskell2010 |
Haskell_ML.FCN
Description
- data FCNet :: Nat -> Nat -> *
- data TrainEvo = TrainEvo {}
- randNet :: (KnownNat i, KnownNat o, MonadRandom m) => [Integer] -> m (FCNet i o)
- runNet :: (KnownNat i, KnownNat o) => FCNet i o -> [R i] -> [R o]
- netTest :: MonadRandom m => Double -> Int -> m String
- hiddenStruct :: FCNet i o -> [Integer]
- getWeights :: (KnownNat i, KnownNat o) => FCNet i o -> [[Double]]
- getBiases :: (KnownNat i, KnownNat o) => FCNet i o -> [[Double]]
- trainNTimes :: (KnownNat i, KnownNat o) => Int -> Double -> FCNet i o -> [(R i, R o)] -> (FCNet i o, TrainEvo)
Documentation
data FCNet :: Nat -> Nat -> * Source #
A fully connected, multi-layer network with fixed input/output widths, but variable (and existentially hidden!) internal structure.
Instances
(KnownNat i, KnownNat o) => Binary (FCNet i o) Source # |
With this definition, the user of our library is able to use standard
|
Data type for holding training evolution data.
randNet :: (KnownNat i, KnownNat o, MonadRandom m) => [Integer] -> m (FCNet i o) Source #
Returns a value of type FCNet
, filled with random weights
ready for training, tucked inside the appropriate Monad, which must
be an instance of MonadRandom
. (IO is such an instance.)
The input/output widths are determined by the compiler automatically, via type inferencing.
The internal structure of the network is determined by the list of integers passed in. Each integer in the list indicates the output width of one hidden layer, with the first entry in the list corresponding to the hidden layer nearest to the input layer.
Arguments
:: (KnownNat i, KnownNat o) | |
=> FCNet i o | the network to run |
-> [R i] | the list of inputs |
-> [R o] | the list of outputs |
Run a network on a list of inputs.
netTest :: MonadRandom m => Double -> Int -> m String Source #
Basic sanity test of our code, taken from Justin's repository.
Printed output should contain two offset solid circles.
FCNet i o -> [Integer] Source #
::Returns a list of integers corresponding to the widths of the hidden
layers of a FCNet
.
getWeights :: (KnownNat i, KnownNat o) => FCNet i o -> [[Double]] Source #
Returns a list of lists of Doubles, each containing the weights of one layer of the network.
getBiases :: (KnownNat i, KnownNat o) => FCNet i o -> [[Double]] Source #
Returns a list of lists of Doubles, each containing the biases of one layer of the network.
Arguments
:: (KnownNat i, KnownNat o) | |
=> Int | Number of epochs |
-> Double | learning rate |
-> FCNet i o | the network to be trained |
-> [(R i, R o)] | the training pairs |
-> (FCNet i o, TrainEvo) |
Train a network on several epochs of the training data, keeping track of accuracy and weight/bias changes per layer, after each.