Example #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);
        }
Example #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);
 }
Example #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);
 }
Example #4
0
 public abstract void Train(UnivariateAlgorithmInput input);
Example #5
0
 public UnivariateAlgorithm(string parameterName, int parameterIndex, UnivariateAlgorithmInput input)
 {
     this.parameterName  = parameterName;
     this.parameterIndex = parameterIndex;
 }
Example #6
0
 public DTW(string parameterName, int parameterIndex, UnivariateAlgorithmInput input) : base(parameterName, parameterIndex, input)
 {
 }