distances
This module provides functions to compute distances between orders.
- distance_matrix(instance, distance_function)
Returns a matrix of the pairwise distance between all orders of the instance.
- Parameters
instance (OrdinalInstance) – The instance to take the orders from.
distance_function (function) – The distance function to use. It should take two orders as input.
- Returns
A Numpy array of the pairwise distances, coordinates being the index of the orders in the order list of the instance.
- Return type
numpy array
- kendall_tau_distance(order1, order2)
Returns the Kendall’s tau distance between two orders.
- Parameters
order1 (tuple) – The first order.
order2 (tuple) – The second order.
- Returns
The Kendall’s tau distance between the two orders.
- Return type
int
- sertel_distance(order1, order2)
Returns the Sertel’s distance between two orders.
- Parameters
order1 (tuple) – The first order.
order2 (tuple) – The second order.
- Returns
The Sertel’s distance between the two orders.
- Return type
float
- spearman_footrule_distance(order1, order2)
Returns the Spearman’s footrule distance between two orders.
- Parameters
order1 (tuple) – The first order.
order2 (tuple) – The second order.
- Returns
The Spearman’s footrule distance between the two orders.
- Return type
float