@Test public void auto_test22(){ double[] v1 = new double[]{7.364858839218932, 1.681033056213912, 2.8205103995348124, 7.865764610173953, 7.543475655590937, 3.836304327223318, 0.3980625841027918, 9.95213480624082, 2.4765494337157157, 1.9170983244374507}; double[] v2 = new double[]{8.623578326570145, 0.9236829039477923, 3.8147511690775127, 7.432668906179073, 2.4559386526899676, 0.8467132881508443, 4.718289570673527, 6.507787746430772, 5.627200321051045, 4.187219974430247}; double res = Roberts.distance(v1, v2); double ref = 0.6186511550296465; Asserts.assertDistance(ref); Asserts.assertEquals(res, ref); }
public static double distance(double[] v1,double[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<v1.length;i++){ sumNum += (v1[i] + v2[i])*(CommonStats.min(v1[i], v2[i])/CommonStats.max(v1[i], v2[i])); sumDenom += (v1[i] + v2[i]); } return sumNum/sumDenom; }
Roberts { public static double distance(double[] v1,double[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<v1.length;i++){ sumNum += (v1[i] + v2[i])*(CommonStats.min(v1[i], v2[i])/CommonStats.max(v1[i], v2[i])); sumDenom += (v1[i] + v2[i]); } return sumNum/sumDenom; } }
Roberts { public static double distance(double[] v1,double[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<v1.length;i++){ sumNum += (v1[i] + v2[i])*(CommonStats.min(v1[i], v2[i])/CommonStats.max(v1[i], v2[i])); sumDenom += (v1[i] + v2[i]); } return sumNum/sumDenom; }  }
Roberts { public static double distance(double[] v1,double[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<v1.length;i++){ sumNum += (v1[i] + v2[i])*(CommonStats.min(v1[i], v2[i])/CommonStats.max(v1[i], v2[i])); sumDenom += (v1[i] + v2[i]); } return sumNum/sumDenom; }  static double distance(double[] v1,double[] v2); }
Roberts { public static double distance(double[] v1,double[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<v1.length;i++){ sumNum += (v1[i] + v2[i])*(CommonStats.min(v1[i], v2[i])/CommonStats.max(v1[i], v2[i])); sumDenom += (v1[i] + v2[i]); } return sumNum/sumDenom; }  static double distance(double[] v1,double[] v2);  }