diff options
author | sanine <sanine.not@pm.me> | 2023-11-21 10:35:07 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-21 10:35:07 -0600 |
commit | 6ab486c73d4d5764ac7b63c46e04c361c776385b (patch) | |
tree | 4ad0cb1c89dda0ad195255b5610240ad351acb67 /src | |
parent | d128c42a96110eceb3a82ff26263388efff20623 (diff) |
add createEmptyNetwork
Diffstat (limited to 'src')
-rw-r--r-- | src/Mind.hs | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/Mind.hs b/src/Mind.hs index 02b98b1..45b90da 100644 --- a/src/Mind.hs +++ b/src/Mind.hs @@ -1,11 +1,30 @@ module Mind ( NeuronIndex (..) , getNeuronIndex + + , Edge (..) + + , Network (..) + , createEmptyNetwork ) where --- types -data NeuronIndex = Input Int | Internal Int | Output Int +-- index different neuron types +data NeuronIndex = Input Int | Internal Int | Output Int deriving (Show, Eq) + getNeuronIndex :: NeuronIndex -> Int -getNeuronIndex i = undefined +getNeuronIndex (Input i) = i +getNeuronIndex (Internal i) = i +getNeuronIndex (Output i) = i + +-- define incident edges +newtype Edge = Edge (NeuronIndex, Float) deriving (Show, Eq) + +-- define networks +data Network = Network + { numInput :: Int + , internalNeurons :: [[Edge]] + , outputNeurons :: [[Edge]] + } deriving (Show, Eq) -newtype Edge = Edge (NeuronIndex, Float) +createEmptyNetwork :: Int -> Int -> Int -> Network +createEmptyNetwork i h o = Network i (replicate h []) (replicate o []) |