@Test public void auto_test26(){ double[] v1 = new double[]{162.729843078934, 734.2260085830886, 462.67531468064095, 696.4679473590778, 349.11498684325295, 570.622455358849, 804.9217042605105, 827.5395540568117, 586.0563475658403, 978.3796108596092}; double[] v2 = new double[]{928.1241590331782, 998.3313100250298, 127.95816096201939, 416.39458296751786, 656.6812400126654, 14.378883532849883, 801.0188518494133, 32.632879761448905, 211.7639912016973, 155.58885237703046}; double res = Roberts.distance(v1, v2); double ref = 0.4701879189234213; 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);  }