method eval input =
(* helper to do the processing of all layers *)
let rec loop rep activation =
(* get the current layer *)
match rep with
layer :: rest_rep ->
begin
if Array.length layer.(0) != Array.length activation +1 then
failwith "Input Size Error"
else ();
(* add the bias *)
let activation = Array.append [|1.0|] activation in
(* calculate the weighted sums *)
let sums = layer |*| activation in
(* apply transfer functions *)
let output = Array.map sigmoid sums in
(* descend to next layer *)
loop rest_rep output
end
| [] -> activation (* we have reached the output layer -> return *)
in
(* apply inputs to all layers *)
loop rep input