You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2020/09/22 00:40:58 UTC
[incubator-datasketches-java] 01/01: terminology, efficiency,
restored test
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch jaccard_similarity_changes
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git
commit 6be785e9ca1bf42374603ab56570ab88d881d2f2
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Mon Sep 21 17:40:40 2020 -0700
terminology, efficiency, restored test
---
.../org/apache/datasketches/theta/JaccardSimilarity.java | 12 ++++++------
.../org/apache/datasketches/theta/JaccardSimilarityTest.java | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java b/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
index 9738c60..8abea88 100644
--- a/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
+++ b/src/main/java/org/apache/datasketches/theta/JaccardSimilarity.java
@@ -38,7 +38,7 @@ public final class JaccardSimilarity {
private static final double[] ONES = {1.0, 1.0, 1.0};
/**
- * Computes the Jaccard similarity ratio with upper and lower bounds. The Jaccard similarity ratio
+ * Computes the Jaccard similarity index with upper and lower bounds. The Jaccard similarity index
* <i>J(A,B) = (A ^ B)/(A U B)</i> is used to measure how similar the two sketches are to each
* other. If J = 1.0, the sketches are considered equal. If J = 0, the two sketches are
* distinct from each other. A Jaccard of .95 means the overlap between the two
@@ -49,7 +49,7 @@ public final class JaccardSimilarity {
*
* @param sketchA given sketch A
* @param sketchB given sketch B
- * @return a double array {LowerBound, Estimate, UpperBound} of the Jaccard ratio.
+ * @return a double array {LowerBound, Estimate, UpperBound} of the Jaccard index.
* The Upper and Lower bounds are for a confidence interval of 95.4% or +/- 2 standard deviations.
*/
public static double[] jaccard(final Sketch sketchA, final Sketch sketchB) {
@@ -70,7 +70,7 @@ public final class JaccardSimilarity {
SetOperation.builder().setNominalEntries(newK).buildUnion();
union.update(sketchA);
union.update(sketchB);
- final Sketch unionAB = union.getResult();
+ final Sketch unionAB = union.getResult(false, null);
final long thetaLongUAB = unionAB.getThetaLong();
final long thetaLongA = sketchA.getThetaLong();
final long thetaLongB = sketchB.getThetaLong();
@@ -87,7 +87,7 @@ public final class JaccardSimilarity {
inter.intersect(sketchA);
inter.intersect(sketchB);
inter.intersect(unionAB); //ensures that intersection is a subset of the union
- final Sketch interABU = inter.getResult(true, null);
+ final Sketch interABU = inter.getResult(false, null);
final double lb = getLowerBoundForBoverA(unionAB, interABU);
final double est = getEstimateOfBoverA(unionAB, interABU);
@@ -134,7 +134,7 @@ public final class JaccardSimilarity {
/**
* Tests similarity of a measured Sketch against an expected Sketch.
- * Computes the lower bound of the Jaccard ratio <i>J<sub>LB</sub></i> of the measured and
+ * Computes the lower bound of the Jaccard index <i>J<sub>LB</sub></i> of the measured and
* expected sketches.
* if <i>J<sub>LB</sub> ≥ threshold</i>, then the sketches are considered to be
* similar with a confidence of 97.7%.
@@ -156,7 +156,7 @@ public final class JaccardSimilarity {
/**
* Tests dissimilarity of a measured Sketch against an expected Sketch.
- * Computes the upper bound of the Jaccard ratio <i>J<sub>LB</sub></i> of the measured and
+ * Computes the upper bound of the Jaccard index <i>J<sub>UB</sub></i> of the measured and
* expected sketches.
* if <i>J<sub>UB</sub> ≤ threshold</i>, then the sketches are considered to be
* dissimilar with a confidence of 97.7%.
diff --git a/src/test/java/org/apache/datasketches/theta/JaccardSimilarityTest.java b/src/test/java/org/apache/datasketches/theta/JaccardSimilarityTest.java
index a069c7d..fe350c2 100644
--- a/src/test/java/org/apache/datasketches/theta/JaccardSimilarityTest.java
+++ b/src/test/java/org/apache/datasketches/theta/JaccardSimilarityTest.java
@@ -208,7 +208,7 @@ public class JaccardSimilarityTest {
double[] jResults = JaccardSimilarity.jaccard(measured, expected);
boolean state = JaccardSimilarity.dissimilarityTest(measured, expected, threshold);
println(state + "\t" + jaccardString(jResults));
- //assertTrue(state);
+ assertTrue(state);
}
private static String jaccardString(double[] jResults) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org