public void GatherStatistics(Network network)
        {
            double averageError = 0;

            foreach (var testElement in TestElements)
            {
                var output = network.ForwardPropagation(testElement.Input);

                var error = Network.MeanSquaredError(output, testElement.DesiredOutput);
                averageError += error;
            }

            averageError /= TestElements.Count;
            TestErrors.Add(averageError);
        }
Пример #2
0
        public void GatherStatistics(Network network)
        {
            double averageError = 0;
            double positiveV    = 0;
            double positiveT    = 0;

            //GET COUNT POSITIVES FOR TESTING SET
            foreach (var testElement in TestElements)
            {
                var output = network.ForwardPropagation(testElement.Input);

                int guessedClass = ConvertMatrixToClass(output);
                int rightClass   = ConvertMatrixToClass(testElement.DesiredOutput);

                if (guessedClass == rightClass)
                {
                    positiveV++;
                }

                var error = Network.MeanSquaredError(output, testElement.DesiredOutput);
                averageError += error;
            }

            AccuracyListV.Add(positiveV / TestElements.Count);
            averageError /= TestElements.Count;
            TestErrors.Add(averageError);


            //GET COUNT POSITIVES FOR TRAINING SET
            foreach (var trainElement in TrainingElements)
            {
                var output = network.ForwardPropagation(trainElement.Input);

                int guessedClass = ConvertMatrixToClass(output);
                int rightClass   = ConvertMatrixToClass(trainElement.DesiredOutput);

                if (guessedClass == rightClass)
                {
                    positiveT++;
                }
            }
            AccuracyListT.Add(positiveT / TrainingElements.Count);
        }