mltool-0.2.0.1: Machine Learning Toolbox

Copyright(c) Alexander Ignatyev 2017
LicenseBSD-3
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

MachineLearning.NeuralNetwork.Topology

Description

Neural Network's Topology

Synopsis

Documentation

data Topology Source #

Neural network topology has at least 2 elements: numver of input and number of outputs. And sizes of hidden layers between 2 elements.

type LossFunc = Matrix -> Matrix -> R Source #

Loss function's type. Takes x, weights and y.

makeTopology :: Int -> [Layer] -> Layer -> LossFunc -> Topology Source #

Makes Neural Network's Topology. Takes number of inputs, list of hidden layers, output layer and loss function.

loss :: Topology -> Regularization -> Matrix -> [(Matrix, Matrix)] -> Matrix -> R Source #

Calculates loss for the given topology. Takes topology, regularization, x, weights, y.

propagateForward :: Topology -> Matrix -> [(Matrix, Matrix)] -> (Matrix, [Cache]) Source #

Implementation of forward propagation algorithm.

propagateBackward :: Topology -> Regularization -> Matrix -> [Cache] -> Matrix -> [(Matrix, Matrix)] Source #

Implementation of backward propagation algorithm.

numberOutputs :: Topology -> Int Source #

Returns number of outputs of the given topology.

initializeTheta :: Int -> Topology -> Vector Source #

Create and initialize weights vector with random values for given neural network topology. Takes a seed to initialize generator of random numbers as a first parameter.

initializeThetaIO :: Topology -> IO Vector Source #

Create and initialize weights vector with random values for given neural network topology inside IO Monad.

initializeThetaM :: RandomGen g => Topology -> Rand g Vector Source #

Create and initialize weights vector with random values for given neural network topology inside RandomMonad.

flatten :: [(Matrix, Matrix)] -> Vector Source #

Flatten list of matrices into vector.

unflatten :: Topology -> Vector -> [(Matrix, Matrix)] Source #

Unflatten vector into list of matrices for given neural network topology.