Distances

A collection of distance measures between points in the Euclidean space and between subspaces on the Grassmann manifold.

Each distance function in UQpy is defined as a subclass of the Distance class. The Distance class has two further subclasses for Euclidean distances (baseclass.EuclideanDistance,) and Grassmann distances (GrassmannianDistance). Individual dsitances, depending on their type, are defined as subclasses of these.

Distance Class

The Distances class is imported using the following command:

>>> from UQpy.utilities.distances.baseclass.Distance import Distance
class Distance[source]

This is the baseclass for all distances in UQpy.

This serves as a blueprint to show the methods for distances implemented in the distances module .

distance_matrix: ndarray

Distance matrix defining the pairwise distances between the points

calculate_distance_matrix(points)[source]

Using the distance-specific compute_distance() method, this function assembles the distance matrix.

Parameters:

points – Set of data points. Depending on the type of kernel these should be either numpy.ndarray or of type GrassmannPoint.

abstract compute_distance(xi, xj)[source]

Given two points, this method calculates their distance. Each concrete distance implementation must override this method and provide its own implementation.

Parameters:
  • xi – First point.

  • xj – Second point.

Return type:

float

Returns:

A float representing the distance between the points.

Types of Distances