Beispiel #1
0
 double Evaluate(INeuralNet network)
 {
     double[] fitnessTests = new double[tests];
     for (int i = 0; i < fitnessTests.Length; i++)
     {
         double[] inputs   = testInputs[i];
         double[] outs     = network.Calculate(inputs);
         double   expected = inputs.Sum() % 2;
         fitnessTests[i] = Fitness(outs[0], expected);
     }
     return(fitnessTests.Average());
 }
Beispiel #2
0
 double Evaluate(INeuralNet network)
 {
     double[] fitnessTests = new double[testInputs.Count];
     for (int i = 0; i < fitnessTests.Length; i++)
     {
         double[] inputs = testInputs[i];
         double[] outs   = network.Calculate(inputs);
         for (int i2 = 0; i2 < outs.Length; i2++)
         {
             outs[i2] = Fitness(testOutputs[i][i2], outs[i2]);
         }
         fitnessTests[i] = outs.Average();
     }
     return(fitnessTests.Average());
 }