Module provides various distance metrics - abstraction of the notion of distance in a metric space. More...
Classes | |
class | distance_metric |
Distance metric performs distance calculation between two points in line with encapsulated function, for example, euclidean distance or chebyshev distance, or even user-defined. More... | |
class | type_metric |
Enumeration of supported metrics in the module for distance calculation between two points. More... | |
Functions | |
def | euclidean_distance (point1, point2) |
Calculate Euclidean distance between two vectors. More... | |
def | euclidean_distance_numpy (object1, object2) |
Calculate Euclidean distance between two objects using numpy. More... | |
def | euclidean_distance_square (point1, point2) |
Calculate square Euclidean distance between two vectors. More... | |
def | euclidean_distance_square_numpy (object1, object2) |
Calculate square Euclidean distance between two objects using numpy. More... | |
def | manhattan_distance (point1, point2) |
Calculate Manhattan distance between between two vectors. More... | |
def | manhattan_distance_numpy (object1, object2) |
Calculate Manhattan distance between two objects using numpy. More... | |
def | chebyshev_distance (point1, point2) |
Calculate Chebyshev distance between between two vectors. More... | |
def | chebyshev_distance_numpy (object1, object2) |
Calculate Chebyshev distance between two objects using numpy. More... | |
def | minkowski_distance (point1, point2, degree=2) |
Calculate Minkowski distance between two vectors. More... | |
def | minkowski_distance_numpy (object1, object2, degree=2) |
Calculate Minkowski distance between objects using numpy. More... | |
def | canberra_distance (point1, point2) |
Calculate Canberra distance between two vectors. More... | |
def | canberra_distance_numpy (object1, object2) |
Calculate Canberra distance between two objects using numpy. More... | |
def | chi_square_distance (point1, point2) |
Calculate Chi square distance between two vectors. More... | |
def | chi_square_distance_numpy (object1, object2) |
Calculate Chi square distance between two vectors using numpy. More... | |
Module provides various distance metrics - abstraction of the notion of distance in a metric space.
def pyclustering.utils.metric.canberra_distance | ( | point1, | |
point2 | |||
) |
def pyclustering.utils.metric.canberra_distance_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.chebyshev_distance | ( | point1, | |
point2 | |||
) |
Calculate Chebyshev distance between between two vectors.
[in] | point1 | (array_like): The first vector. |
[in] | point2 | (array_like): The second vector. |
def pyclustering.utils.metric.chebyshev_distance_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.chi_square_distance | ( | point1, | |
point2 | |||
) |
def pyclustering.utils.metric.chi_square_distance_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.euclidean_distance | ( | point1, | |
point2 | |||
) |
Calculate Euclidean distance between two vectors.
The Euclidean between vectors (points) a and b is calculated by following formula:
Where N is a length of each vector.
[in] | point1 | (array_like): The first vector. |
[in] | point2 | (array_like): The second vector. |
def pyclustering.utils.metric.euclidean_distance_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.euclidean_distance_square | ( | point1, | |
point2 | |||
) |
Calculate square Euclidean distance between two vectors.
[in] | point1 | (array_like): The first vector. |
[in] | point2 | (array_like): The second vector. |
Definition at line 315 of file metric.py.
Referenced by pyclustering.utils.metric.euclidean_distance().
def pyclustering.utils.metric.euclidean_distance_square_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.manhattan_distance | ( | point1, | |
point2 | |||
) |
Calculate Manhattan distance between between two vectors.
[in] | point1 | (array_like): The first vector. |
[in] | point2 | (array_like): The second vector. |
def pyclustering.utils.metric.manhattan_distance_numpy | ( | object1, | |
object2 | |||
) |
def pyclustering.utils.metric.minkowski_distance | ( | point1, | |
point2, | |||
degree = 2 |
|||
) |
Calculate Minkowski distance between two vectors.
[in] | point1 | (array_like): The first vector. |
[in] | point2 | (array_like): The second vector. |
[in] | degree | (numeric): Degree of that is used for Minkowski distance. |
Definition at line 427 of file metric.py.
Referenced by pyclustering.utils.metric.distance_metric.disable_numpy_usage().
def pyclustering.utils.metric.minkowski_distance_numpy | ( | object1, | |
object2, | |||
degree = 2 |
|||
) |
Calculate Minkowski distance between objects using numpy.
[in] | object1 | (array_like): The first array_like object. |
[in] | object2 | (array_like): The second array_like object. |
[in] | degree | (numeric): Degree of that is used for Minkowski distance. |
Definition at line 451 of file metric.py.
Referenced by pyclustering.utils.metric.distance_metric.disable_numpy_usage().