Exemple #1
0
        protected override void Train(GestureData gestureData)
        {
            MultivariateAlgorithmInput multivariateInput = new MultivariateAlgorithmInput(gestureData);

            CreateUnivariateAlgorithms(multivariateInput);

            FindBestGestures(gestureData);
            TrainAlgorithms(multivariateInput);
        }
Exemple #2
0
 private void TrainAlgorithms(MultivariateAlgorithmInput multivariateInput)
 {
     foreach (string key in Gesture.parameterKeys)
     {
         for (int i = 0; i < parametersToAlgorithms[key].Length; i++)
         {
             parametersToAlgorithms[key][i].Train(multivariateInput[key][i]);
         }
     }
 }
Exemple #3
0
 private void CreateUnivariateAlgorithms(MultivariateAlgorithmInput multivariateInput)
 {
     foreach (string key in Gesture.parameterKeys)
     {
         UnivariateAlgorithmInput[] value = multivariateInput[key];
         int dimension = value.Length;
         UnivariateAlgorithm[] algorithms = new UnivariateAlgorithm[dimension];
         for (int i = 0; i < dimension; i++)
         {
             object[] args = { key, i, value[i] };
             algorithms[i] = (UnivariateAlgorithm)Activator.CreateInstance(typeof(Algorithm), args);
         }
         parametersToAlgorithms[key] = algorithms;
     }
 }
Exemple #4
0
        public override double ComputeError(GestureData data)
        {
            MultivariateAlgorithmInput multivariateInput = new MultivariateAlgorithmInput(data);
            List <double> results = new List <double>();

            foreach (string key in Gesture.parameterKeys)
            {
                UnivariateAlgorithmInput[] value = multivariateInput[key];
                int dimension = value.Length;
                for (int i = 0; i < dimension; i++)
                {
                    results.Add(parametersToAlgorithms[key][i].ComputeError(value[i].data));
                }
            }
            return(results.ToArray().Max());
        }