Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersectionCardinality giving the wrong result #20

Closed
rasoolianbehnam opened this issue Aug 17, 2021 · 1 comment
Closed

intersectionCardinality giving the wrong result #20

rasoolianbehnam opened this issue Aug 17, 2021 · 1 comment

Comments

@rasoolianbehnam
Copy link

rasoolianbehnam commented Aug 17, 2021

I'm trying to experiment with the code in scala and wrote the following pieces as a test case

import com.liveramp.hyperminhash._
import java.util.ArrayList
val sketch1 = new BetaMinHash()
val sketch2 = new BetaMinHash()
val set1 = (1 to 10000).map(_.toByte).toArray
val set2 = (5000 to 15000).map(_.toByte).toArray
sketch1.offer(set1)
sketch2.offer(set2)
val sketches = new ArrayList[BetaMinHash]()
sketches.add(sketch1)
sketches.add(sketch2)
val combiner = BetaMinHashCombiner.getInstance();
val combined = combiner.intersectionCardinality(sketches);

combined gives me 0 while the actual result should be something around 5000. Am I doing something wrong here?

@rasoolianbehnam
Copy link
Author

this issue is fixed, I had a typo in my code. It's fixed by doing the following:

import com.liveramp.hyperminhash._
import java.util.ArrayList
val sketch1 = new HyperMinHash(5, 2)
val sketch2 = new HyperMinHash(5, 2)
(1 to 10000).foreach (e=> sketch1.offer(e.toString().getBytes()))
(5000 to 15000).foreach (e=> sketch2.offer(e.toString().getBytes()))
sketch1.offer(set1)
sketch2.offer(set2)
val sketches = new ArrayList[HyperMinHash]()
sketches.add(sketch1)
sketches.add(sketch2)
val combiner = HyperMinHashCombiner.getInstance();
val combined = combiner.intersectionCardinality(sketches);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant