Methods
canberra(a, b) → {Number}
Computes the canberra distance between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the canberra distance between a
and b
.
- Type:
- Number
chebyshev(a, b) → {Number}
Computes the chebyshev distance (L∞) between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the chebyshev distance between a
and b
.
- Type:
- Number
cosine(a, b) → {Number}
Computes the cosine distance (not similarity) between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
The cosine distance between a
and b
.
- Type:
- Number
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
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the euclidean distance between a
and b
.
- Type:
- Number
euclidean_squared(a, b) → {Number}
Computes the squared euclidean distance (l22) between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
the squared euclidean distance between a
and b
.
- Type:
- Number
hamming(a, b) → {Number}
Computes the hamming distance between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the hamming distance between a
and b
.
- Type:
- Number
jaccard(a, b) → {Number}
Computes the jaccard distance between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the jaccard distance between a
and b
.
- Type:
- Number
manhattan(a, b) → {Number}
Computes the manhattan distance (l1
) between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the manhattan distance between a
and b
.
- Type:
- Number
sokal_michener(a, b) → {Number}
Computes the Sokal-Michener distance between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the Sokal-Michener distance between a
and b
.
- Type:
- Number
yule(a, b) → {Number}
Computes the yule distance between a
and b
.
Name | Type | Description |
---|---|---|
a | Array.<Number> | |
b | Array.<Number> |
- Source
the yule distance between a
and b
.
- Type:
- Number