com.soundcloud.lsh

Lsh

class Lsh extends Joiner with Serializable

Lsh implementation as described in 'Randomized Algorithms and NLP: Using Locality Sensitive Hash Function for High Speed Noun Clustering' by Ravichandran et al. See original publication for a detailed description of the parameters.

Linear Supertypes
Serializable, Serializable, Joiner, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Lsh
  2. Serializable
  3. Serializable
  4. Joiner
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Lsh(minCosineSimilarity: Double, dimensions: Int, numNeighbours: Int, numPermutations: Int, partitions: Int = 200, storageLevel: StorageLevel = ...)

    minCosineSimilarity

    minimum similarity two items need to have otherwise they are discarded from the result set

    dimensions

    number of random vectors (hyperplanes) to generate bit vectors of length d

    numNeighbours

    beam factor e.g. how many neighbours are considered in the sliding window

    numPermutations

    number of times bitsets are permuted

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def bitSetIsEqual(vec1: BitSet, vec2: BitSet): Boolean

    Compares two bit sets for their equality

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def createSlidingWindow(signatures: RDD[Signature], b: Int): RDD[Seq[Signature]]

    Creates a sliding window

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def findNeighbours(signatures: RDD[Seq[Signature]], minCosineSimilarity: Double): RDD[MatrixEntry]

  14. def generatePermutation(size: Int): Iterable[Int]

    Generates a random permutation of size n

  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hamming(vec1: BitSet, vec2: BitSet): Int

    Returns the hamming distance between two bit vectors

  17. def hammingToCosine(hammingDistance: Int, d: Double): Double

    Approximates the cosine distance of two bit sets using their hamming distance

  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  20. def join(inputMatrix: IndexedRowMatrix): CoordinateMatrix

    Definition Classes
    LshJoiner
  21. def localRandomMatrix(d: Int, numFeatures: Int): Matrix

    Returns a local k by d matrix with random gaussian entries mean=0.

    Returns a local k by d matrix with random gaussian entries mean=0.0 and std=1.0

    This is a k by d matrix as it is multiplied by the input matrix

  22. def matrixToBitSet(inputMatrix: IndexedRowMatrix, localRandomMatrix: Matrix): RDD[Signature]

    Converts a given input matrix to a bit set representation using random hyperplanes

  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. def neighbours(signatures: Iterable[Signature], minCosineSimilarity: Double): Iterator[MatrixEntry]

    Generate all pairs and emit if cosine of pair > minCosineSimilarity

  25. final def notify(): Unit

    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  27. def orderByBitSet(signatures: RDD[Signature]): RDD[Signature]

    Orderes an RDD of signatures by their bit set representation

  28. def permuteBitSet(bitSet: BitSet, permutation: Iterable[Int], d: Int): BitSet

    Permutes a bit set representation of a vector by a given permutation

  29. def permuteBitSet(signatures: RDD[Signature], permutation: Iterable[Int], d: Int): RDD[Signature]

    Permutes a signatures by a given permutation

  30. def random(): Double

    Draws a random number with mean 0 and standard deviation of 1

  31. val randomGenerator: Random

  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  33. def toString(): String

    Definition Classes
    AnyRef → Any
  34. def vectorToBitSet(vector: Vector): BitSet

    Converts a vector to a bit set by replacing all values of x with sign(x)

  35. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Joiner

Inherited from AnyRef

Inherited from Any

Ungrouped