Exemplo n.º 1
0
        static void test_randomizing()
        {
            vnn     nn;
            trainer tr;
            double  mean = 0.0;
            double  to   = 1.0;

            for (int i = 0; i < to; i++)
            {
                nn = new vnn(2, 2, 1);
                tr = new trainer(nn, data.DataSets.xorProblem, 0.1, 0.9);
                Stopwatch sw = Stopwatch.StartNew();
                tr.TrainUntilAccuracy(0.8, 0.2, 100);
                mean += sw.ElapsedMilliseconds;
            }
            Console.WriteLine(mean / to);
            Console.ReadKey();
        }
Exemplo n.º 2
0
            void test()
            {
                vnn     nn = new vnn(2, 1000, 2, addon.RandomizeWeights);
                trainer tr = new trainer(nn, data.DataSets.twoParamTest, 0.01, 0.9);

                tr.TrainUntilAccuracy(0.9, 0.1);

                int    counter = 0;
                double mean    = 0.0;

                foreach (var v in nn.wHiddenOutput)
                {
                    mean += Abs(v);
                    if (Abs(v) < 1.0 / nn.nHidden)
                    {
                        counter++;
                    }
                }
                mean = mean / nn.wHiddenOutput.Length;

                WriteLine("weak = " + counter);
                WriteLine("% = " + counter / (double)nn.wHiddenOutput.Length);
                WriteLine("Mean = " + mean + "; level = " + 1.0 / nn.nHidden);
            }