Example #1
0
        private BackpropAlgorithm createBPAlg()
        {
            var net = NetworkFactory.CreateFullyConnectedNetwork(new[] { 2, 15, 3 }, Activation.Logistic(1));

            net[0].DropoutRate = 0.1D;
            net.IsTraining     = true;

            var alg = new BackpropAlgorithm(Data.TrainingSample, net);

            alg.EpochCount   = 6000;
            alg.LearningRate = 0.01D;
            alg.BatchSize    = 10;
            alg.LossFunction = Loss.Euclidean;

            int epoch = 0;

            alg.EpochEndedEvent += (o, e) =>
            {
                if (epoch++ % 300 != 0)
                {
                    return;
                }
                Console.WriteLine("----------------Epoch #: {0}", epoch);
                Console.WriteLine("L:\t{0}", alg.ErrorValue);
                Console.WriteLine("DL:\t{0}", alg.ErrorDelta);
                Console.WriteLine("DW:\t{0}", alg.Step2);
            };

            return(alg);
        }