Package

com.soundcloud

lsh

Permalink

package lsh

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. lsh
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class BitSet extends Serializable

    Permalink

    A simple, fixed-size bit set implementation.

    A simple, fixed-size bit set implementation. This implementation is fast because it avoids safety/bound checking.

  2. trait Joiner extends AnyRef

    Permalink
  3. class Lsh extends Joiner with Serializable

    Permalink

    Lsh implementation as described in 'Randomized Algorithms and NLP: Using Locality Sensitive Hash Function for High Speed Noun Clustering' by Ravichandran et al.

    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.

    See also

    http://dl.acm.org/citation.cfm?id=1219917

  4. class NearestNeighbours extends Joiner with Serializable

    Permalink

    Brute force O(n2) method to compute exact nearest neighbours. As this is a very expensive computation O(n2) an additional sample parameter may be passed such that neighbours are just computed for a random fraction.

  5. class QueryHamming extends QueryJoiner with Serializable

    Permalink

    Implementation based on approximated cosine distances.

    Implementation based on approximated cosine distances. The cosine distances are approximated using hamming distances which are way faster to compute. Either the catalog matrix or the query matrix is broadcasted. This implementation is therefore suited for tasks where one of the matrices is very small (in order to be broadcastet) compared to the query matrix.

  6. trait QueryJoiner extends AnyRef

    Permalink
  7. class QueryLsh extends QueryJoiner with Serializable

    Permalink

    Standard Lsh implementation.

    Standard Lsh implementation. The queryMatrix is hashed multiple times and exact hash matches are searched for in the dbMatrix. These candidates are used to compute the cosine distance.

  8. class QueryNearestNeighbours extends QueryJoiner with Serializable

    Permalink

    Brute force O(size(query) * size(catalog)) method to compute exact nearest neighbours for rows in the query matrix.

    Brute force O(size(query) * size(catalog)) method to compute exact nearest neighbours for rows in the query matrix. As this is a very expensive computation, additional sample parameters may be passed such that neighbours are just computed for a random fraction of the data set.

  9. final case class Signature(index: Long, vector: Vector, bitSet: BitSet) extends Ordered[Signature] with Product with Serializable

    Permalink

    An id with it's hash encoding and original vector.

  10. class SlidingRDD[T] extends RDD[Array[T]]

    Permalink

    Represents an RDD from grouping items of its parent RDD in fixed size blocks by passing a sliding window over them.

    Represents an RDD from grouping items of its parent RDD in fixed size blocks by passing a sliding window over them. The ordering is first based on the partition index and then the ordering of items within each partition. This is similar to sliding in Scala collections, except that it becomes an empty RDD if the window size is greater than the total number of items. It needs to trigger a Spark job if the parent RDD has more than one partitions. To make this operation efficient, the number of items per partition should be larger than the window size and the window size should be small, e.g., 2.

    See also

    Int)*

    Int)*

  11. class SlidingRDDPartition[T] extends Partition with Serializable

    Permalink

    NOTE: both classes are copied from mllib and slightly modified since these classes are mllib private! Modified lines are marked with comments

  12. final case class SparseSignature(index: Long, bitSet: BitSet) extends Ordered[SparseSignature] with Product with Serializable

    Permalink

    An id with it's hash encoding.

  13. case class SubBucket(bucketHash: Int, subBucketId: Int = 1) extends Product with Serializable

    Permalink
  14. trait VectorDistance extends Serializable

    Permalink

    interface defining similarity measurement between 2 vectors

Value Members

  1. object BitSet extends Serializable

    Permalink
  2. object Cosine extends VectorDistance

    Permalink

    implementation of VectorDistance that computes cosine similarity between two vectors

  3. object Main

    Permalink
  4. object SparkImplicits

    Permalink
  5. def bitSetComparator(a: BitSet, b: BitSet): Int

    Permalink

    Compares two bit sets according to the first different bit

  6. def bitSetIsEqual(vec1: BitSet, vec2: BitSet): Boolean

    Permalink

    Compares two bit sets for their equality

  7. def bitSetToString(bs: BitSet): String

    Permalink

    Returns a string representation of a BitSet

  8. def distinct(matrix: RDD[MatrixEntry]): RDD[MatrixEntry]

    Permalink

    Take distinct matrix entry values based on the indices only.

    Take distinct matrix entry values based on the indices only. The actual values are discarded.

  9. def hamming(vec1: BitSet, vec2: BitSet): Int

    Permalink

    Returns the hamming distance between two bit vectors

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

    Permalink

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

  11. def localRandomMatrix(d: Int, numFeatures: Int): Matrix

    Permalink

    Returns a local k by d matrix with random gaussian entries mean=0.0 and std=1.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

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

    Permalink

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

  13. def matrixToBitSetSparse(inputMatrix: IndexedRowMatrix, localRandomMatrix: Matrix): RDD[SparseSignature]

    Permalink

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

  14. def vectorToBitSet(vector: Vector): BitSet

    Permalink

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

Inherited from AnyRef

Inherited from Any

Ungrouped