Enums#

class vecworks.enums.DENSITY#

Describes density of a vector.

dense: int = 0#

A vector representation storing both zero- and non-zero elements.

sparse: int = 1#

A vector representation storing only non-zero elements.

class vecworks.enums.DISTANCES#

Specifies how the (dis)similarity between two vectors is calculated.

cosine: str = 'cosine'#

Compares the orientation of two vectors by calculating the angle between two non-zero vectors.

hamming: str = 'hamming'#

Counts the number of positions at which two vectors’ corresponding elements are different.

jaccard: str = 'jaccard'#

Considers vectors as sets, calculating the degree of overlap between both vectors/sets.

l1: str = 'l1'#

Takes two equal-length vectors, calculating pairwise the absolute difference between both vectors’ elements, summing up the results to produce a single distance measure.

l2: str = 'l2'#

Takes two equal-length vectors, calculating pairwise the absolute difference between both vectors’ elements, squaring up the results before them up into a single distance measure.

nip: str = 'nip'#

Takes two equal-length vectors, multiplying both vectors’ elements pairwise, summing up the results. Multiplied with 1 to allow a higher inner product to represent greater similarity.

class vecworks.enums.ENSEMBLERS#

Specifies the ‘ensembler’ to use to combine the results of multiple vector comparisons.

rrf: str = 'rrf'#

Reciprocal Rank Fusion (RRF) is a method for combining vector similarity measures based on rank. For each pair of vector indices it ranks the similarity, finally aggregating these rankings to produce a single similarity measure.