Beispiel #1
0
        public int ClosestClassifier()
        {
            int [] errorScores = new int[3];
            for (int n = 0; n <= 2; n++)
            {
                int currentError = 0;
                for (int h = 0; h < 1023; h++)
                {
                    currentError = currentError + Math.Abs(learnedHistograms[3][h] - learnedHistograms[n][h]);
                }
                errorScores[n] = currentError;
                TraceMessages.AddMessage($"Comparison with case {n} yields error score of {currentError}");
            }
            int minIndex = Array.IndexOf(errorScores, errorScores.Min());

            return(minIndex);
        }
Beispiel #2
0
        public void ShowHistogram(int classifier)
        {
            int[] histogramToShow;

            if (classifier == -1)
            {
                histogramToShow = histogramToClassify;
            }
            else
            {
                histogramToShow = learnedHistograms[classifier];
            }

            TraceMessages.AddMessage($"Showing classifier for {classifier}");

            for (int i = 0; i < histogramToShow.Length; i++)
            {
                if (histogramToShow[i] != 0)
                {
                    TraceMessages.AddMessage($"{i} = {histogramToShow[i]}");
                }
            }
        }