haskell-ml-0.4.1: Machine learning in Haskell

Copyright(c) David Banas 2018
LicenseBSD-3
Maintainercapn.freako@gmail.com
Stabilityexperimental
Portability?
Safe HaskellNone
LanguageHaskell2010

Haskell_ML.FCN

Description

 

Synopsis

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 #

Binary instance definition for FCNet.

With this definition, the user of our library is able to use standard put and get calls, to serialize his created/trained network for future use. And we don't need to provide auxilliary saveNet and loadNet functions in the API.

Methods

put :: FCNet i o -> Put #

get :: Get (FCNet i o) #

putList :: [FCNet i o] -> Put #

data TrainEvo Source #

Data type for holding training evolution data.

Constructors

TrainEvo 

Fields

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.

runNet Source #

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.

hiddenStruct :: 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.

trainNTimes Source #

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.