Class

com.twitter.cassovary.algorithms.similarity

CosineSimilarity

Related Doc: package similarity

Permalink

class CosineSimilarity extends Similarity

Calculate cosine similarity for a specific graph. Cosine Similarity of two nodes is the size of their common neighbors divided by the geometric mean of their degrees

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

Instance Constructors

  1. new CosineSimilarity(graph: DirectedGraph[Node])

    Permalink

    graph

    The graph object to calculate the cosine similarity

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def calculateSimilarity(u: Int, v: Int, dir: GraphDir): Double

    Permalink

    Execute the Similarity algorithm between two nodes.

    Execute the Similarity algorithm between two nodes.

    u

    current node ID

    v

    another node ID to check the similarity with current node

    dir

    direction of edges in Directed Graph

    returns

    Similarity score of two nodes

    Definition Classes
    CosineSimilaritySimilarity
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def getNeighbors(nodeId: Int, dir: GraphDir = GraphDir.OutDir): Option[Set[Int]]

    Permalink
    Attributes
    protected
    Definition Classes
    Similarity
  12. def getTopKAllSimilarPairs(k: Int, dir: GraphDir = GraphDir.OutDir): Map[Int, Seq[(Int, Double)]]

    Permalink

    Iterate over each node in the graph and get top k nodes with non-zero similarity score for each node.

    Iterate over each node in the graph and get top k nodes with non-zero similarity score for each node.

    k

    limit for similar nodes

    dir

    direction of edges in Directed Graph

    returns

    Map with key as node Id and value as Seq of top k similar node ids and similarity score.

    Definition Classes
    Similarity
  13. def getTopKSimilarNodes(u: Int, k: Int, dir: GraphDir = GraphDir.OutDir): Seq[(Int, Double)]

    Permalink

    Iterate over graph nodes and calculate similarity scores for each node.

    Iterate over graph nodes and calculate similarity scores for each node. If the graph stores edges in both in and out direction, then iterate over the neighbors in reverse dir of neighbors of node u.

    u

    current node ID

    k

    limit for similar nodes

    dir

    direction of edges in Directed Graph

    returns

    Seq of top k similar node ids and their similarity score with node u. Nodes with non-zero score are added. So, the length of the Seq can be less than k

    Definition Classes
    Similarity
  14. val graph: DirectedGraph[Node]

    Permalink

    The graph object to calculate the cosine similarity

    The graph object to calculate the cosine similarity

    Definition Classes
    CosineSimilaritySimilarity
  15. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Similarity

Inherited from AnyRef

Inherited from Any

Ungrouped