Methods

canberra(a, b) → {Number}

Computes the canberra distance between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the canberra distance between a and b.

Type: 
Number

chebyshev(a, b) → {Number}

Computes the chebyshev distance (L) between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the chebyshev distance between a and b.

Type: 
Number

cosine(a, b) → {Number}

Computes the cosine distance (not similarity) between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

The cosine distance between a and b.

Type: 
Number
Example
import * as druid from "@saehrimnir/druidjs";

druid.cosine([1,0],[1,1]) == 0.7853981633974484 == π/4;

euclidean(a, b) → {Number}

Computes the euclidean distance (l2) between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the euclidean distance between a and b.

Type: 
Number

euclidean_squared(a, b) → {Number}

Computes the squared euclidean distance (l22) between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the squared euclidean distance between a and b.

Type: 
Number

hamming(a, b) → {Number}

Computes the hamming distance between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the hamming distance between a and b.

Type: 
Number

jaccard(a, b) → {Number}

Computes the jaccard distance between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the jaccard distance between a and b.

Type: 
Number

manhattan(a, b) → {Number}

Computes the manhattan distance (l1) between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the manhattan distance between a and b.

Type: 
Number

sokal_michener(a, b) → {Number}

Computes the Sokal-Michener distance between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the Sokal-Michener distance between a and b.

Type: 
Number

yule(a, b) → {Number}

Computes the yule distance between a and b.

Parameters:
NameTypeDescription
aArray.<Number>
bArray.<Number>
Returns:

the yule distance between a and b.

Type: 
Number