Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
This module provides an efficient connection matrix type.
- data ConnMatrix
- buildLayered :: [Int] -> IO ConnMatrix
- buildRandom :: Int -> IO ConnMatrix
- buildZero :: Int -> ConnMatrix
- cmAdd :: ConnMatrix -> ConnMatrix -> ConnMatrix
- cmDests :: forall b. Int -> (b -> Int -> Double -> b) -> b -> ConnMatrix -> b
- cmFold :: Int -> (b -> Int -> Double -> b) -> b -> ConnMatrix -> b
- cmMap :: (Int -> Int -> Double -> Double) -> ConnMatrix -> ConnMatrix
- cmSize :: ConnMatrix -> Int
- addLayer :: Int -> Int -> Int -> Int -> ConnMatrix -> IO ConnMatrix
Connection matrix
data ConnMatrix Source
A connection matrix is essentially a two-dimensional array of synaptic weights.
Construction
buildLayered :: [Int] -> IO ConnMatrixSource
Build a layered connection matrix, where adjacent layers are fully connected.
buildRandom :: Int -> IO ConnMatrixSource
Build a completely random connection matrix with the given edge length. The random values will be between -1 and 1 exclusive.
buildZero :: Int -> ConnMatrixSource
Build a zero connection matrix. It will represent a completely disconnected network, where all nodes are isolated.
Accessing
cmAdd :: ConnMatrix -> ConnMatrix -> ConnMatrixSource
Add two connection matrices. Note that this function is left-biased in that it will adopt the connectivity of the first connection matrix.
You may want to use the Monoid
instance instead of this function.
cmDests :: forall b. Int -> (b -> Int -> Double -> b) -> b -> ConnMatrix -> bSource
Strictly fold over the outputs, including zeroes.
cmFold :: Int -> (b -> Int -> Double -> b) -> b -> ConnMatrix -> bSource
Strictly fold over the nonzero inputs of a node.
cmMap :: (Int -> Int -> Double -> Double) -> ConnMatrix -> ConnMatrixSource
Map over the inputs of a node.
cmSize :: ConnMatrix -> IntSource
Edge length of a connection matrix.
Modification
addLayer :: Int -> Int -> Int -> Int -> ConnMatrix -> IO ConnMatrixSource
addLayer s1 n1 s2 n2
overwrite n1
nodes starting from s1
to
be fully connected with random weights to the n2
nodes starting
from s2
.