Beispiel #1
0
        private void Check_Button_Click(object sender, RoutedEventArgs e)
        {
            if (neuralNetwork != null)
            {
                BitArray imageInputs = imageViewer.GetCurrentImage();
                neuralNetwork.SetInputs(imageInputs);
                neuralNetwork.Propagate();
                double[] imageOutputs = neuralNetwork.GetOutputs();

                double networkOutput = outputConverter.GetMostProbablyValue(imageOutputs);
                neuralNetOutputLabel.Content = networkOutput.ToString();

                if (userCorrectImageValue.Text.Length > 0)
                {
                    int value;

                    if (Int32.TryParse(userCorrectImageValue.Text, out value))
                    {
                        BitArray expectedOutput    = outputConverter.GetOutputs(value);
                        double   outputProbability = outputConverter.GetProbability(imageOutputs, expectedOutput);

                        expectedOutputLabel.Content    = value.ToString();
                        outputProbabilityLabel.Content = String.Format("{0:0.00} %", outputProbability);
                        return;
                    }
                }

                expectedOutputLabel.Content    = "";
                outputProbabilityLabel.Content = "";
            }
        }