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 void Train(UnivariateAlgorithmInput algorithmInput)
 {
     if (registers.Count == 0)
     {
         throw new Exception("Best gestures need to be registered before this method is called");
     }
     CreateThresholds(algorithmInput);
 }
Ejemplo n.º 3
0
 private void CreateDictionary()
 {
     foreach (Parameter parameter in Gesture.parameters)
     {
         UnivariateAlgorithmInput[] inputs = new UnivariateAlgorithmInput[parameter.Dimension()];
         for (int i = 0; i < parameter.Dimension(); i++)
         {
             inputs[i] = new UnivariateAlgorithmInput();
         }
         Add(parameter.key, inputs);
     }
     Assert.AreEqual(Gesture.parameterKeys.Count, Count);
 }
Ejemplo n.º 4
0
 public abstract void Train(UnivariateAlgorithmInput input);
Ejemplo n.º 5
0
 public UnivariateAlgorithm(string parameterName, int parameterIndex, UnivariateAlgorithmInput input)
 {
     this.parameterName  = parameterName;
     this.parameterIndex = parameterIndex;
 }
Ejemplo n.º 6
0
 public DTW(string parameterName, int parameterIndex, UnivariateAlgorithmInput input) : base(parameterName, parameterIndex, input)
 {
 }