public Connection(Layer previousLayer, Layer nextLayer, WeightMatrix weightMatrix, Bias bias, double learningRate, int activationMethod)
 {
     _activationMethod = activationMethod;
     _learningRate     = learningRate;
     PrevLayer         = previousLayer;
     NextLayer         = nextLayer;
     Weights           = weightMatrix;
     Biases            = bias;
     _deltaWeights     = new WeightMatrix(nextLayer.Values.Length, previousLayer.Values.Length);
     _deltaBias        = new Bias(nextLayer.Values.Length);
 }
 private void SetUpConnections(Connection[] connectionsArray, double learningRate, int activationMethod)
 {
     for (int i = 1; i < noOfLayers; i++)
     {
         var    weights         = new WeightMatrix(MyLayers[i].Values.Length, MyLayers[i - 1].Values.Length);
         var    bias            = new Bias(MyLayers[i].Values.Length);
         string weightsFilePath = directoryName + @"Weights\" + $"{name}_Weights_{i - 1}_{i}.csv";
         string biasesFilePath  = directoryName + @"Biases\" + $"{name}_Biases_{i - 1}_{i}.csv";
         weights.Randomise();
         bias.Randomise();
         if (File.Exists(weightsFilePath))
         {
             weights.Populate(CsvHandler.GetWeights(weightsFilePath));
         }
         if (File.Exists(biasesFilePath))
         {
             bias.Populate(CsvHandler.GetBias(biasesFilePath));
         }
         connectionsArray[i - 1] = new Connection(MyLayers[i - 1], MyLayers[i], weights, bias, learningRate, activationMethod);
     }
 }