Distance Functions
L1Norm
Calculates the sum of absolute values of a vector.
Syntax
Alias: normL1
.
Arguments
Returned value
- L1-norm or taxicab geometry distance. UInt, Float or Decimal.
Examples
Query:
Result:
L2Norm
Calculates the square root of the sum of the squares of the vector values.
Syntax
Alias: normL2
.
Arguments
Returned value
- L2-norm or Euclidean distance. Float.
Example
Query:
Result:
L2SquaredNorm
Calculates the square root of the sum of the squares of the vector values (the L2Norm) squared.
Syntax
Alias: normL2Squared
.
*Arguments
Returned value
- L2-norm squared. Float.
Example
Query:
Result:
LinfNorm
Calculates the maximum of absolute values of a vector.
Syntax
Alias: normLinf
.
Arguments
Returned value
- Linf-norm or the maximum absolute value. Float.
Example
Query:
Result:
LpNorm
Calculates the root of p
-th power of the sum of the absolute values of a vector in the power of p
.
Syntax
Alias: normLp
.
Arguments
Returned value
Example
Query:
Result:
L1Distance
Calculates the distance between two points (the values of the vectors are the coordinates) in L1
space (1-norm (taxicab geometry distance)).
Syntax
Alias: distanceL1
.
Arguments
Returned value
- 1-norm distance. Float.
Example
Query:
Result:
L2Distance
Calculates the distance between two points (the values of the vectors are the coordinates) in Euclidean space (Euclidean distance).
Syntax
Alias: distanceL2
.
Arguments
Returned value
- 2-norm distance. Float.
Example
Query:
Result:
L2SquaredDistance
Calculates the sum of the squares of the difference between the corresponding elements of two vectors.
Syntax
Alias: distanceL2Squared
.
Arguments
Returned value
- Sum of the squares of the difference between the corresponding elements of two vectors. Float.
Example
Query:
Result:
LinfDistance
Calculates the distance between two points (the values of the vectors are the coordinates) in L_{inf}
space (maximum norm).
Syntax
Alias: distanceLinf
.
Arguments
Returned value
- Infinity-norm distance. Float.
Example
Query:
Result:
LpDistance
Calculates the distance between two points (the values of the vectors are the coordinates) in Lp
space (p-norm distance).
Syntax
Alias: distanceLp
.
Arguments
vector1
— First vector. Tuple or Array.vector2
— Second vector. Tuple or Array.p
— The power. Possible values: real number from[1; inf)
. UInt or Float.
Returned value
- p-norm distance. Float.
Example
Query:
Result:
L1Normalize
Calculates the unit vector of a given vector (the values of the tuple are the coordinates) in L1
space (taxicab geometry).
Syntax
Alias: normalizeL1
.
Arguments
tuple
— Tuple.
Returned value
Example
Query:
Result:
L2Normalize
Calculates the unit vector of a given vector (the values of the tuple are the coordinates) in Euclidean space (using Euclidean distance).
Syntax
Alias: normalizeL1
.
Arguments
tuple
— Tuple.
Returned value
Example
Query:
Result:
LinfNormalize
Calculates the unit vector of a given vector (the values of the tuple are the coordinates) in L_{inf}
space (using maximum norm).
Syntax
Alias: normalizeLinf
.
Arguments
tuple
— Tuple.
Returned value
Example
Query:
Result:
LpNormalize
Calculates the unit vector of a given vector (the values of the tuple are the coordinates) in Lp
space (using p-norm).
Syntax
Alias: normalizeLp
.
Arguments
Returned value
Example
Query:
Result:
cosineDistance
Calculates the cosine distance between two vectors (the values of the tuples are the coordinates). The smaller the returned value is, the more similar are the vectors.
Syntax
Arguments
Returned value
- Cosine of the angle between two vectors subtracted from one. Float.
Examples
Query:
Result: