public void Train_Multilayer_SaveThenLoad()
        {
            var network = new MultilayerNetwork(4, new[] { 4, 2 });

            var bp = new BackPropagationLearning(network);

            var input = ColumnVector1D.Create(0, 0.2, 0.66, 0.28);
            var output = ColumnVector1D.Create(0, 0, 0, 0.999);

            var err = bp.Train(input, output);

            using (var ms = new MemoryStream())
            {
                network.Save(ms);

                ms.Position = 0;

                var network2 = MultilayerNetwork.LoadData(ms);

                Assert.That(network2 != null);

                var output2 = network2.Evaluate(ColumnVector1D.Create(0.1, 0.3, 0.2, 0.1));

                Assert.That(output2 != null);
            }
        }
        public void Train_Multilayer_IsTrained()
        {
            var network = new MultilayerNetwork(4, new[] { 4, 2 });

            var bp = new BackPropagationLearning(network);

            var input = ColumnVector1D.Create(0, 0.2, 0.66, 0.28);
            var output = ColumnVector1D.Create(0, 0, 0, 0.999);

            var err = bp.Train(input, output);

            Assert.That(err > 0);
        }
        public void InitialiseAndTrain_ReturnsErrorGt0(int layer1Size, int layer2Size)
        {
            var parameters = new NetworkParameters(new int[] { 4, layer1Size, layer2Size, 4 });

            var network = new MultilayerNetwork(parameters);

            var bp = new BackPropagationLearning(network);

            var input = ColumnVector1D.Create(0, 0.2, 0.66, 0.28);
            var output = ColumnVector1D.Create(0, 0, 0, 0.999);

            var err = bp.Train(input, output);

            Assert.That(err > 0);
        }