@Test public void test5(){ int[] v1 = new int[]{1,0,1,1,0,0,1}; int[] v2 = new int[]{1,1,0,1,1,1,1}; double res = Hamann.distance(v1, v2); Asserts.assertEquals(res, 0.57142857); }
public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return 1-((double)(matches[0]+matches[3])/(double)v1.length); }
Rand { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return 1-((double)(matches[0]+matches[3])/(double)v1.length); } }
Rand { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return 1-((double)(matches[0]+matches[3])/(double)v1.length); }  }
Rand { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return 1-((double)(matches[0]+matches[3])/(double)v1.length); }  static double distance(int[] v1, int[] v2); }
Rand { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return 1-((double)(matches[0]+matches[3])/(double)v1.length); }  static double distance(int[] v1, int[] v2);  }