Example #1
0
        static float QuadraticWholeCost(NeuralNet neuralNet, LearningExample[] learningExamples)
        {
            float wholeCost = 0;

            for (int i = 0; i < learningExamples.Length; i++)
            {
                wholeCost += QuadraticSingleCost(learningExamples[i].Output, neuralNet.Compute(learningExamples[i].Input));
            }
            return(wholeCost / learningExamples.Length);
        }
Example #2
0
        static float CrossEntropyWholeCost(NeuralNet neuralNet, LearningExample[] learningExamples)
        {
            float wholeCost = 0;

            for (int i = 0; i < learningExamples.Length; i++)
            {
                float singleCost = CrossEntropySingleCost(learningExamples[i].Output, neuralNet.Compute(learningExamples[i].Input));
                wholeCost += singleCost;
            }
            return(-wholeCost / learningExamples.Length);
        }