Table Of Contents

This Page

similarity Package

cos Module

Created on Oct 2, 2012

@author: georgianadinu

class composes.similarity.cos.CosSimilarity

Bases: composes.similarity.similarity.Similarity

Computes the cosine similarity of two vectors.

\(sim(\vec{u},\vec{v}) = \frac{<\vec{u},\vec{v}>}{\sqrt{||\vec{u}||||\vec{v}||}}\)

dot_prod Module

Created on Oct 2, 2012

@author: georgianadinu

class composes.similarity.dot_prod.DotProdSimilarity

Bases: composes.similarity.similarity.Similarity

Computes the scalar product (dot product) of two vectors.

\(sim(\vec{u},\vec{v}) = <\vec{u},\vec{v}> = \sum_iu_iv_i\)

euclidean Module

Created on Oct 2, 2012

@author: georgianadinu

class composes.similarity.euclidean.EuclideanSimilarity

Bases: composes.similarity.similarity.Similarity

Computes the euclidean similarity of two vectors as the inverse of their euclidean distance.

\(sim(\vec{u},\vec{v}) = \frac{1}{||\vec{u}-\vec{v}|| + 1}\)

lin Module

Created on Oct 2, 2012

@author: georgianadinu

class composes.similarity.lin.LinSimilarity

Bases: composes.similarity.similarity.Similarity

Computes the Lin similarity of two vectors.

\(sim(\vec{u},\vec{v}) = \frac{\sum_{i \in I}(u_i+v_i)}{\sum_iu_i + \sum_iv_i}\)

Where \(I=\{i | u_i > 0 \text{ and } v_i > 0\}\), the set of components on which both vectors are strictly positive.

similarity Module

Created on Oct 2, 2012

@author: georgianadinu

class composes.similarity.similarity.Similarity

Bases: object

classdocs

get_name()
get_sim(v1, v2)
get_sims_to_matrix(vector, matrix_)
name