cleanup work

This commit is contained in:
Eugen Paraschiv
2018-03-04 17:39:09 +02:00
parent 14bf9a24d5
commit d2a2a65566
193 changed files with 1504 additions and 2388 deletions
@@ -8,16 +8,15 @@ import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
public class LocalSensitiveHashingUnitTest {
@Ignore("for simplicity of the example number of input vectors is very low, that's why LSH may yield non deterministic results")
@Test()
public void givenNVectors_whenPerformLSH_thenShouldCalculateSameHashForSimilarVectors() {
//given
boolean[] vector1 = new boolean[]{true, true, true, true, true};
boolean[] vector2 = new boolean[]{false, false, false, true, false};
boolean[] vector3 = new boolean[]{false, false, true, true, false};
// given
boolean[] vector1 = new boolean[] { true, true, true, true, true };
boolean[] vector2 = new boolean[] { false, false, false, true, false };
boolean[] vector3 = new boolean[] { false, false, true, true, false };
int sizeOfVectors = 5;
int numberOfBuckets = 10;
@@ -25,7 +24,7 @@ public class LocalSensitiveHashingUnitTest {
LSHMinHash lsh = new LSHMinHash(stages, numberOfBuckets, sizeOfVectors);
//when
// when
int[] firstHash = lsh.hash(vector1);
int[] secondHash = lsh.hash(vector2);
int[] thirdHash = lsh.hash(vector3);
@@ -34,7 +33,7 @@ public class LocalSensitiveHashingUnitTest {
System.out.println(Arrays.toString(secondHash));
System.out.println(Arrays.toString(thirdHash));
//then
// then
int lastIndexOfResult = stages - 1;
assertThat(firstHash[lastIndexOfResult]).isNotEqualTo(secondHash[lastIndexOfResult]);
assertThat(firstHash[lastIndexOfResult]).isNotEqualTo(thirdHash[lastIndexOfResult]);
@@ -45,4 +44,3 @@ public class LocalSensitiveHashingUnitTest {
return Math.abs(secondHash - thirdHash) < numberOfBuckets / 2;
}
}