public void BackPropagateWeightedCombinerBankIsCorrect()
        {
            int numberOfBanks      = 3;
            WeightedCombiner layer = new WeightedCombiner(new WeightsMatrix(new double[, ] {
                { 1 }
            }));
            WeightedCombinerBank bank        = new WeightedCombinerBank(layer, numberOfBanks);
            NetworkVector        inputVector = new NetworkVector(new double[] { 1, 2, 3 });
            NetworkVector        bpVector    = new NetworkVector(new double[] { 5, 7, 11 });

            bank.Run(inputVector);
            NetworkVector inputGradientCheck = new NetworkVector(new double[] { 5, 7, 11 });

            Assert.AreEqual(inputGradientCheck, bank.InputGradient(bpVector));


            bank.BackPropagate(bpVector, inputVector);
            bank.Update(new GradientDescent());

            WeightsMatrix weightsCheck = new WeightsMatrix(new double[, ] {
                { -51 }
            });
            NetworkVector biasCheck = new NetworkVector(new double[] { -23 });

            Assert.AreEqual(biasCheck, bank.Biases);
            Assert.AreEqual(weightsCheck, bank.Weights);
        }
        public void InputGradientWeightedCombinerBank()
        {
            int numberOfBanks      = 3;
            WeightedCombiner layer = new WeightedCombiner(new WeightsMatrix(new double[, ] {
                { 1 }
            }));
            WeightedCombinerBank bank       = new WeightedCombinerBank(layer, numberOfBanks);
            NetworkVector        zeroVector = new NetworkVector(numberOfBanks);

            bank.BackPropagate(zeroVector, new NetworkVector(3));
            Assert.AreEqual(zeroVector, bank.InputGradient(zeroVector));
        }
        public void CorrectInputGradientOneInput()
        {
            int numberOfBanks      = 3;
            WeightedCombiner layer = new WeightedCombiner(new WeightsMatrix(new double[, ] {
                { 1 }
            }));
            WeightedCombinerBank bank               = new WeightedCombinerBank(layer, numberOfBanks);
            NetworkVector        input              = new NetworkVector(new double[] { 2, 3, 5 });
            NetworkVector        outputGradient     = new NetworkVector(new double[] { 2, 3, 5 });
            NetworkVector        inputGradientCheck = new NetworkVector(new double[] { 2, 3, 5 });

            Assert.AreEqual(inputGradientCheck, bank.InputGradient(outputGradient));
        }