Created
May 9, 2014 19:47
-
-
Save kaja47/554f62c61f21b0420720 to your computer and use it in GitHub Desktop.
minhash vs. HyperLogLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// min-hash | |
val fs: Vector[Int => Int] // hash funkce | |
items map { it => fs map { f => f(it) } } fold (vectorPairwise(min), initialValue = Vector.fill(infinity)) | |
// HyperLogLog | |
val fs: Vector[Int => Int] = 0 until 16384 map { i => { it => val (prefix, suffix) = f(it); if (prefix == i) positionOfFirstOneBit(suffix) else 0 } } | |
items map { it => fs map { f => f(it) } } fold (vectorPairwise(max), initialValue = Vector.fill(0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment