@Test public void test8(){ int[] v1 = new int[]{1,0,1,1,0,1,0,1,1,0}; int[] v2 = new int[]{1,1,0,1,1,1,1,1,0,0}; double res = RusselRao.distance(v1, v2); Asserts.assertEquals(res, 0.6); }
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])/(double)(v1.length)); }
RusselRao { 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])/(double)(v1.length)); } }
RusselRao { 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])/(double)(v1.length)); }  }
RusselRao { 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])/(double)(v1.length)); }  static double distance(int[] v1, int[] v2); }
RusselRao { 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])/(double)(v1.length)); }  static double distance(int[] v1, int[] v2);  }