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