我不是统计专家。但是...我会绘制一个图并比较每个点与另一个图上的等效点之间的差异,一次一个点。我会使用 Math.Abs() 将这 10 个差异中的每一个都转换为正数,然后使用您希望的任何方法(平均值、中位数等)来取 10 个差异的平均值。我会重复每个其他情节的比较。大多数计算可以沿途放弃,您只需要保留每个图的平均数。最小的平均值可能是最接近匹配的图。
因为我今天没有太多事情要做...
Dictionary<string, int[]> plots = new Dictionary<string, int[]>();
plots.Add("px1", new int[] { 90, 70, 100, 80, 60, 50, 70, 90, 75, 65 });
plots.Add("px2", new int[] { 5, 10, 15, 20, 25, 30, 18, 12, 20, 10 });
plots.Add("px3", new int[] { 15, 20, 15, 8, 3, 12, 28, 32, 12, 20 });
plots.Add("px4", new int[] { 20, 30, 10, 3, 5, 8, 24, 28, 15, 18 });
plots.Add("px5", new int[] { 60, 85, 32, 9, 15, 24, 70, 84, 45, 54 });
plots.Add("px6", new int[] { 10, 15, 18, 44, 12, 16, 25, 22, 16, 25 });
string test = "px4";
string winner = string.Empty;
double smallestAverage = double.MaxValue;
foreach (string key in plots.Keys)
{
if (key == test)
{
continue;
}
int[] a = plots[test];
int[] b = plots[key];
double count = 0;
for (int point = 0; point <= 9; point++)
{
count += Math.Abs(a[point] - b[point]);
}
double average = count / 10;
if (average < smallestAverage)
{
smallestAverage = average;
winner = key;
}
}
Console.WriteLine("Winner: {0}", winner);