private void deal(params ActionData[] actions) { try { if (actions.Length < 2) { return; } for (int i = 1; i < actions.Length; i++) { double[,] similarityMatrix = ActionMatchingUtil.computeSimilarityMatrix(actions[0], actions[i]); DTWResult dtwResult = DTWUtil.DTW(similarityMatrix); StringBuilder sb = new StringBuilder(); sb.Append("result:\n"); sb.Append("Similarity:").Append(dtwResult.SumSimilarity).Append(", AvgSimilarity:").Append(dtwResult.AvgSimilarity).Append(", PathLength:").Append(dtwResult.PathLength).Append('\n'); sb.Append(dtwResult.PathStr); LogUtil.log(sb.ToString()); } } catch (Exception e) { LogUtil.log(e.Message); } }
public static bool match(ActionData action1, ActionData action2) { double[,] similarityMatrix = ActionMatchingUtil.computeSimilarityMatrix(action1, action2); DTWResult dtwResult = DTWUtil.DTW(similarityMatrix); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("result:\n"); sb.Append("Similarity:").Append(dtwResult.SumSimilarity).Append(", AvgSimilarity:").Append(dtwResult.AvgSimilarity).Append(", PathLength:").Append(dtwResult.PathLength).Append('\n'); sb.Append(dtwResult.PathStr); LogUtil.log(sb.ToString()); return(dtwResult.AvgSimilarity < 0.04); }