@Test public void test1(){ double[] v1 = new double[]{3,7,8}; double[] v2 = new double[]{4,8,9}; Asserts.assertEqualLength(v1, v2); double res = ModifiedHausdorff.distance(v1, v2); Asserts.assertEquals(res, 0.666666); }
public static double distance(double v1[], double v2[]){ double sumV1 = 0; double sumV2 = 0; for(int i=0;i<v1.length;i++){ sumV1 += keyToArrayDistance(v2,v1[i]); sumV2 += keyToArrayDistance(v1,v2[i]); } return CommonStats.max(sumV1/v1.length, sumV2/v2.length); }
ModifiedHausdorff { public static double distance(double v1[], double v2[]){ double sumV1 = 0; double sumV2 = 0; for(int i=0;i<v1.length;i++){ sumV1 += keyToArrayDistance(v2,v1[i]); sumV2 += keyToArrayDistance(v1,v2[i]); } return CommonStats.max(sumV1/v1.length, sumV2/v2.length); } }
ModifiedHausdorff { public static double distance(double v1[], double v2[]){ double sumV1 = 0; double sumV2 = 0; for(int i=0;i<v1.length;i++){ sumV1 += keyToArrayDistance(v2,v1[i]); sumV2 += keyToArrayDistance(v1,v2[i]); } return CommonStats.max(sumV1/v1.length, sumV2/v2.length); }  }
ModifiedHausdorff { public static double distance(double v1[], double v2[]){ double sumV1 = 0; double sumV2 = 0; for(int i=0;i<v1.length;i++){ sumV1 += keyToArrayDistance(v2,v1[i]); sumV2 += keyToArrayDistance(v1,v2[i]); } return CommonStats.max(sumV1/v1.length, sumV2/v2.length); }  static double keyToArrayDistance(double array[], double key); static double distance(double v1[], double v2[]); }
ModifiedHausdorff { public static double distance(double v1[], double v2[]){ double sumV1 = 0; double sumV2 = 0; for(int i=0;i<v1.length;i++){ sumV1 += keyToArrayDistance(v2,v1[i]); sumV2 += keyToArrayDistance(v1,v2[i]); } return CommonStats.max(sumV1/v1.length, sumV2/v2.length); }  static double keyToArrayDistance(double array[], double key); static double distance(double v1[], double v2[]);  }