Inner Distances — Map of Objects

Skip to main content
`Ctrl`+`K`

# Inner Distances

chebyshev(vector_1: list, vector_2: list) → float

  Computes the Chebyshev distance.

  Parameters:

    - vector_1 (list) – First vector.

    - vector_2 (list) – Second vector.

  Returns:

    Chebyshev distance.

  Return type:

    float

discrete(vector_1, vector_2) → int

  Computes the discrete distance.

  Parameters:

    - vector_1 – First vector.

    - vector_2 – Second vector.

  Returns:

    Discrete distance.

  Return type:

    int

emd(vector_1: list, vector_2: list) → float

  Computes the EMD distance.

  Parameters:

    - vector_1 (list) – First vector.

    - vector_2 (list) – Second vector.

  Returns:

    EMD distance.

  Return type:

    float

emdinf(vector_1: list, vector_2: list) → float

  Computes the EMD-infinity distance.

  Parameters:

    - vector_1 (list) – First vector.

    - vector_2 (list) – Second vector.

  Returns:

    EMD-infinity distance.

  Return type:

    float

hamming(set_1: set, set_2: set) → int

  Computes the Hamming distance between two sets.

  Parameters:

    - set_1 (set) – First vector.

    - set_2 (set) – Second vector.

  Returns:

    Hamming distance.

  Return type:

    int

hellinger(vector_1: list, vector_2: list) → float

  Computes the Hellinger distance.

  Parameters:

    - vector_1 (list) – First vector.

    - vector_2 (list) – Second vector.

  Returns:

    Hellinger distance.

  Return type:

    float

l1(vector_1: ndarray, vector_2: ndarray) → float

  Computes the L1 distance.

  Parameters:

    - vector_1 (np.ndarray) – First vector.

    - vector_2 (np.ndarray) – Second vector.

  Returns:

    L1 distance.

  Return type:

    float

l2(vector_1: ndarray, vector_2: ndarray) → float

  Computes the L2 distance.

  Parameters:

    - vector_1 (np.ndarray) – First vector.

    - vector_2 (np.ndarray) – Second vector.

  Returns:

    L2 distance.

  Return type:

    float

map_str_to_func(name: str) → callable

  Maps a string to a function.

  Parameters:

    name (str) – Name of the distance.

  Return type:

    callable

single_l1(value_1, value_2) → float

  Computes the L1 distance between two values.

  Parameters:

    - value_1 – First value.

    - value_2 – Second values.

  Returns:

    L1 distance.

  Return type:

    float

swap_distance(vote_1: list, vote_2: list, matching=None) → int

  Return: Swap distance between two votes

swap_distance_between_potes(pote_1: list, pote_2: list) → int

  Return: Swap distance between two potes

vote_to_pote(vote: list) → list

  Converts vote to pote (i.e. positional vote)

  Parameters:

    vote (list) – Ordinal vote.

  Returns:

    Potes (i.e. positional votes).

  Return type:

    list