@Test public void test4(){ int[] v1 = new int[]{1,0,1,1,0,1}; int[] v2 = new int[]{1,1,0,1,1,0}; Asserts.assertEqualLength(v1, v2); double res = PatternDifference.distance(v1, v2); Asserts.assertEquals(res, 0.44444); }
public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); Asserts.assertHasAllZeros(v1); Asserts.assertHasAllZeros(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return (double)(4*matches[1]*matches[2])/(double)(Math.pow(v1.length,2)); }
PatternDifference { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); Asserts.assertHasAllZeros(v1); Asserts.assertHasAllZeros(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return (double)(4*matches[1]*matches[2])/(double)(Math.pow(v1.length,2)); } }
PatternDifference { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); Asserts.assertHasAllZeros(v1); Asserts.assertHasAllZeros(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return (double)(4*matches[1]*matches[2])/(double)(Math.pow(v1.length,2)); }  }
PatternDifference { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); Asserts.assertHasAllZeros(v1); Asserts.assertHasAllZeros(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return (double)(4*matches[1]*matches[2])/(double)(Math.pow(v1.length,2)); }  static double distance(int[] v1, int[] v2); }
PatternDifference { public static double distance(int[] v1, int[] v2){ Asserts.assertEqualLength(v1, v2); Asserts.assertIsBinary(v1); Asserts.assertIsBinary(v2); Asserts.assertHasAllZeros(v1); Asserts.assertHasAllZeros(v2); int[] matches = CommonStats.processTwoBinaryVectors(v1, v2); return (double)(4*matches[1]*matches[2])/(double)(Math.pow(v1.length,2)); }  static double distance(int[] v1, int[] v2);  }