Ejemplo n.º 1
0
        private Dictionary <int, double> CreateThresholds(UnivariateAlgorithmInput algorithmInput)
        {
            AlgorithmInputData data = algorithmInput.data;

            thresholds = new Dictionary <int, double>();
            for (int i = 0; i < data.input.Length; i++)
            {
                int classIndex = data.output[i];
                if (GestureDataManager.GetClassName(classIndex) != "Nothing")
                {
                    double distance = ComputeDistance(data.input[i], registers[classIndex]);
                    if (!thresholds.ContainsKey(classIndex))
                    {
                        thresholds[classIndex] = distance;
                    }
                    else
                    {
                        thresholds[classIndex] = Math.Max(thresholds[classIndex], distance);
                    }
                }
            }
            List <int> keys = thresholds.Keys.ToList();

            foreach (int key in keys)
            {
                thresholds[key] *= 2;
            }
            return(thresholds);
        }
Ejemplo n.º 2
0
        public override double ComputeError(AlgorithmInputData data)
        {
            Assert.IsTrue(data.input.Length == data.output.Length && data.input.Length > 0, "The length should be equal - input : " + data.input.Print() + " output : " + data.output.Print());
            Assert.IsTrue(data.input[0].Length > 10, "The data is too short :" + data.input[0].Print());
            double nbFalse = 0;
            double nbTrue  = 0;

            for (int i = 0; i < data.input.Length; i++)
            {
                if (GestureDataManager.GetClassName(data.output[i]) != "Nothing")
                {
                    List <string> errors;
                    if (!(Recognize(data.input[i], out errors).ContainsKey(data.output[i])))
                    {
                        nbFalse++;
                    }
                    else
                    {
                        nbTrue++;
                    }
                }
            }
            double error = nbFalse / (nbFalse + nbTrue);

            return(error);
        }
Ejemplo n.º 3
0
 public abstract double ComputeError(AlgorithmInputData input);