anchor.diff:                       Inputs = List.empty
                        Weights = ((*) inputSize hiddenSize) |> listRandElems |> List.chunkBySize inputSize
                        Bias = listRandElems hiddenSize
  +                     Gradients = List.empty
                        PrevDeltas = List.replicate hiddenSize <| List.replicate inputSize 0.0
                        BiasPrevDeltas = List.replicate hiddenSize 0.0
                        NetOutputs = List.empty
  
positive.code:    let fullfilepath = @"D:\Projects\AI\cardiotocography\script\"+filename
     log fullfilepath
  
    (* write error *)
    let errors trained_err validated_err = trained_err + "," + validated_err + "\n"
    logToDataFile "errors.txt" <| errors (rms_trained_err.ToString()) (rms_validated_err.ToString())
  
    (* write appropriate parameters.
     -h1,h2,output weights and biases. *)
    let logNetworkParameters =
     (netAcc.FirstHiddenLayer.Weights |> matrixToString) + "," +
     (netAcc.FirstHiddenLayer.Bias |> vectorToString) + "," +
     (netAcc.SecondHiddenLayer.Weights |> matrixToString) + "," +
     (netAcc.SecondHiddenLayer.Bias |> vectorToString) + "," +
     (netAcc.OutputLayer.Weights |> matrixToString) + "," +
     (netAcc.OutputLayer.Bias |> vectorToString) + "\n"
    logToDataFile "weightsAndBiases.txt" <| logNetworkParameters
  
    if epoch % 100 = 0 then printfn "%f %f" rms_trained_err rms_validated_err
    train ((-) epoch 1) trained (training_samples, teachingInputs) (testing_samples, testOutputs)
  
negative.code:  let firstHiddenNetOutputs = List.map tanh firstHiddenWeightedSum
   let secondHiddenWeightedSum = weightedSum firstHiddenNetOutputs net.SecondHiddenLayer.Weights net.SecondHiddenLayer.Bias
   let secondHiddenNetOutputs = List.map tanh secondHiddenWeightedSum
   let outputWeightedSum = weightedSum secondHiddenNetOutputs net.OutputLayer.Weights net.OutputLayer.Bias
   let outputs = List.map tanh outputWeightedSum
   {
    net with
     FirstHiddenLayer = {
                         net.FirstHiddenLayer with
                          Inputs = net.Inputs
                          NetOutputs = firstHiddenNetOutputs
                        }
     SecondHiddenLayer = {
                          net.SecondHiddenLayer with
                           Inputs = firstHiddenNetOutputs
                           NetOutputs = secondHiddenNetOutputs
                         }
     OutputLayer = {
                    net.OutputLayer with
                     Inputs = secondHiddenNetOutputs
                     NetOutputs = outputs
                   }
   }
  
  
  let bpOutputLayer n m tOutputs (layer:Layer) =
   let grads = List.map2 (gradient deltaTanH) layer.NetOutputs tOutputs
   let bpDeltas = deltas n grads layer.Inputs
   let prevDeltasWithM = List.map (smul m) layer.PrevDeltas
   let newDeltas = List.map2 add bpDeltas prevDeltasWithM
   let weightsUpdate= List.map2 add layer.Weights newDeltas
   let biasDeltas = smul n grads
   let biasPrevDeltasWithM = smul m layer.BiasPrevDeltas
   let biasNewDeltas = add biasDeltas biasPrevDeltasWithM
   let biasUpdate = add layer.Bias biasNewDeltas
   {
    layer with
     Weights = weightsUpdate
     Bias = biasUpdate
     Gradients = grads
     PrevDeltas = newDeltas
     BiasPrevDeltas = biasNewDeltas
   }
  
  let bpHiddenLayer n m layer nextLayer =
   let grads = mul (List.map deltaTanH layer.NetOutputs) (List.map (dot nextLayer.Gradients) (transpose nextLayer.Weights))
   let bpDeltas = deltas n grads layer.Inputs
   let prevDeltasWithM = List.map (smul m) layer.PrevDeltas
   let newDeltas = List.map2 add bpDeltas prevDeltasWithM
   let weightsUpdate = List.map2 add layer.Weights newDeltas
   let biasDeltas = smul n grads
   let biasPrevDeltasWithM = smul m layer.BiasPrevDeltas
   let biasNewDeltas = add biasDeltas biasPrevDeltasWithM
   let biasUpdate = add layer.Bias biasNewDeltas
   {
    layer with
     Weights = weightsUpdate
     Bias = biasUpdate
     Gradients = grads
     PrevDeltas = newDeltas
     BiasPrevDeltas = biasNewDeltas
   }
  
  let backPropagate (net:Network) =
   let bpOutputLayer = bpOutputLayer net.LearningRate net.Momentum net.TargetOutputs net.OutputLayer
   let bpHidLayerWithHyperParams = bpHiddenLayer net.LearningRate net.Momentum
   let bpSecHidLayer = bpHidLayerWithHyperParams net.SecondHiddenLayer bpOutputLayer
   let bpFirstHidLayer = bpHidLayerWithHyperParams net.FirstHiddenLayer bpSecHidLayer
   {
    net with
     OutputLayer = bpOutputLayer
     SecondHiddenLayer = bpSecHidLayer
     FirstHiddenLayer =  bpFirstHidLayer
   }
  
  let rec train
  