Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Created October 26, 2015 15:35
Show Gist options
  • Save primaryobjects/a9866fee99f6a89e1bda to your computer and use it in GitHub Desktop.
Save primaryobjects/a9866fee99f6a89e1bda to your computer and use it in GitHub Desktop.
Mining Massive Datasets - 7a LSH Family, Hash Functions
#
# Q1
# Suppose we have an LSH family h of (d1,d2,.6,.4) hash functions. We can use three functions from h and the AND-construction to form a (d1,d2,w,x) family, and we can use two functions from h and the OR-construction to form a (d1,d2,y,z) family. Calculate w, x, y, and z, and then identify the correct value of one of these in the list below.
#
val1 <- .6
val2 <- .4
# AND construction
w <- val1 ^ 3
x <- val2 ^ 3
# OR construction
y <- 1 - ((1 - val1) ^ 2)
z <- 1 - ((1 - val2) ^ 2)
c(w=w, x=x, y=y, z=z)
# w x y z
# 0.216 0.064 0.840 0.640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment