Basic module for creating and using Artificial Neural Networks (ANNs).
create function
Network.create [(1, 0.5), (2, -0.1)] [(1, 2, -0.5)]setValues is used to set values of input nodes
someNetwork |> Network.setValues [(0, 1), (1, -0.5)]activate updates the network node values using the Step function
someNetwork |> Network.activate toDot create graph description see https://en.wikipedia.org/wiki/DOT_(graph_description_language) can be vizualised with https://rise4fun.com/agl or https://dreampuf.github.io/GraphvizOnline/ or using ports with https://github.com/mdaines/viz.js/
Network.create [(0, 1), (1, 0)] [(0, 1, -0.5)]
|> Network.toDot
-- ==
digraph {
0 [label="0=1"]
1 [label="1=0"]
0 -- 1 [label="-0.5"]
}fitness function defined as 1 - RMSE = 1 - Root of Mean Squared Error, this calcuation is done per sample and then summed for all samples, which should mean the result gives how many correct answer the network gave (kind of). see https://www.researchgate.net/figure/The-root-mean-squared-error-RMSE-when-the-genetic-algorithm-is-implemented-with-fitness_fig1_319382166
Network.create [(1, 0), (2, 0)] [(1, 2, 1.0)]
|> Network.fitness
[ ([(1, 0)], [(2, 0)])
, ([(1, 1)], [(2, 1)])
]
-- == 2.0 (Meaning both samples correctly answered)
Representing an Artificial Neural Network