DistanceMetrics Module

Functions for computing distances of elements or sets

Types and nested modules

Type/Module Description

Array

Vector

Distance<'a>

Signiture type for distance functions

Functions and values

Function or value Description

cityblock s1 s2

Full Usage: cityblock s1 s2

Parameters:
    s1 : seq<^a> -
    s2 : seq<^a> -

Returns: float
Modifiers: inline
Type parameters: ^a, ^b

Cityblock distance of two coordinate float sequences

s1 : seq<^a>

s2 : seq<^a>

Returns: float

Example

cityblockNaN s1 s2

Full Usage: cityblockNaN s1 s2

Parameters:
    s1 : seq<float> -
    s2 : seq<float> -

Returns: float

Cityblock distance of two coordinate float sequences

s1 : seq<float>

s2 : seq<float>

Returns: float

Example

dissimilarity v1 v2

Full Usage: dissimilarity v1 v2

Parameters:
    v1 : seq<^b>
    v2 : seq<^b>

Returns: float
Modifiers: inline
Type parameters: ^b

"Dissimilarity" uses 1. - pearsons correlation coefficient

v1 : seq<^b>
v2 : seq<^b>
Returns: float

euclidean s1 s2

Full Usage: euclidean s1 s2

Parameters:
    s1 : seq<^a> -
    s2 : seq<^a> -

Returns: ^f
Modifiers: inline
Type parameters: ^a, ^d, ^e, ^f

Euclidean distance of two coordinate sequences

s1 : seq<^a>

s2 : seq<^a>

Returns: ^f

Example

euclideanNaN s1 s2

Full Usage: euclideanNaN s1 s2

Parameters:
    s1 : seq<float> -
    s2 : seq<float> -

Returns: float

Euclidean distance of two coordinate float sequences (ignores nan)

s1 : seq<float>

s2 : seq<float>

Returns: float

Example

euclideanNaNSquared s1 s2

Full Usage: euclideanNaNSquared s1 s2

Parameters:
    s1 : seq<float> -
    s2 : seq<float> -

Returns: float

Squared Euclidean distance of two coordinate float sequences (ignores nan)

s1 : seq<float>

s2 : seq<float>

Returns: float

Example

hamming s1 s2

Full Usage: hamming s1 s2

Parameters:
    s1 : 'a - first sequence
    s2 : 'a - second sequence

Returns: int Hamming distance between elements of given sequences
Modifiers: inline

Calculates Hamming distance of two coordinate items

Note, distance between Nan and Nan is equal to 1

s1 : 'a

first sequence

s2 : 'a

second sequence

Returns: int

Hamming distance between elements of given sequences

Example

 
 // e.g. s1 and s2 initialization
 let s1 = seq {1; 2; 3}
 let s2 = seq {9; 2; 3}
 
 // Apply the hamming to s1 and s2
 hamming s1 s2

minkowski s1 s2 p

Full Usage: minkowski s1 s2 p

Parameters:
    s1 : seq<^a> - first sequence
    s2 : seq<^a> - second sequence
    p : float - float constrained to `p > 0`

Returns: float option Minkowski distance between elements of given sequences. Returns NaN if sequences contain NaN.
Modifiers: inline
Type parameters: ^a

The [Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) between two sequence of order `p`.

The two sequences need not have equal lengths: when one sequence is exhausted any remaining elements in the other sequence are ignored.

s1 : seq<^a>

first sequence

s2 : seq<^a>

second sequence

p : float

float constrained to `p > 0`

Returns: float option

Minkowski distance between elements of given sequences. Returns NaN if sequences contain NaN.

Example

 
 // e.g. a1 and a2 initialization
 let s1 = seq { 3.14; 2.0; 3.1 }
 let s2 = { 9.1; 2.5; 3.7 }
 
 // Apply the minkowski distance to s1 and s2
 minkowski s1 s2 3

minkowskiNaN s1 s2 p

Full Usage: minkowskiNaN s1 s2 p

Parameters:
    s1 : seq<^a>
    s2 : seq<^a>
    p : float

Returns: float option
Modifiers: inline
Type parameters: ^a

The [Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) between two sequences (ignores NaN) of order `p`. Non-regular differences between the sequences are ignored. The two sequences need not have equal lengths: when one sequence is exhausted any remaining elements in the other sequence are ignored. first sequence second sequence float constrained to `p > 0` Minkowski distance between elements of given sequences. // e.g. a1 and a2 initialization let s1 = seq { 3.14; 2.0; 3.1 } let s2 = { 9.1; 2.5; 3.7 } // Apply the minkowski distance to s1 and s2 minkowskiNaN s1 s2 3

s1 : seq<^a>
s2 : seq<^a>
p : float
Returns: float option

wagnerFischerLazy s t

Full Usage: wagnerFischerLazy s t

Parameters:
    s : string -
    t : string -

Returns: int

Levenshtein distance between

s : string

t : string

Returns: int

Example