@Test public void test6(){ int[] v1 = new int[]{638, 398, 337, 529, 514}; int[] v2 = new int[]{689, 869, 383, 706, 620}; Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double res = HistogramIntersection.distance(v1, v2); Asserts.assertEquals(res, 0.0); }
public static double distance(int[] h1,int[] h2){ Asserts.assertHasAllZeros(h1); Asserts.assertHasAllZeros(h2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<h1.length;i++){ sumNum += CommonStats.min(h1[i], h2[i]); sumDenom += h1[i]; } return 1 - (((double)sumNum)/sumDenom); }
HistogramIntersection { public static double distance(int[] h1,int[] h2){ Asserts.assertHasAllZeros(h1); Asserts.assertHasAllZeros(h2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<h1.length;i++){ sumNum += CommonStats.min(h1[i], h2[i]); sumDenom += h1[i]; } return 1 - (((double)sumNum)/sumDenom); } }
HistogramIntersection { public static double distance(int[] h1,int[] h2){ Asserts.assertHasAllZeros(h1); Asserts.assertHasAllZeros(h2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<h1.length;i++){ sumNum += CommonStats.min(h1[i], h2[i]); sumDenom += h1[i]; } return 1 - (((double)sumNum)/sumDenom); }  }
HistogramIntersection { public static double distance(int[] h1,int[] h2){ Asserts.assertHasAllZeros(h1); Asserts.assertHasAllZeros(h2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<h1.length;i++){ sumNum += CommonStats.min(h1[i], h2[i]); sumDenom += h1[i]; } return 1 - (((double)sumNum)/sumDenom); }  static double distance(int[] h1,int[] h2); }
HistogramIntersection { public static double distance(int[] h1,int[] h2){ Asserts.assertHasAllZeros(h1); Asserts.assertHasAllZeros(h2); double sumNum = 0; double sumDenom = 0; for(int i=0;i<h1.length;i++){ sumNum += CommonStats.min(h1[i], h2[i]); sumDenom += h1[i]; } return 1 - (((double)sumNum)/sumDenom); }  static double distance(int[] h1,int[] h2);  }