Distances
Implementation of different distance metrics.
- class ecgan.utils.distances.DistanceMetric[source]
Bases:
abc.ABC
A base class for different distance metrics to inherit from.
- abstract calculate(point_1, point_2)[source]
Calculate the distance between two points (arrays of same size).
- Parameters
point_1 (
Union
[ndarray
,Tensor
]) -- Some data with at least 1 dimension.point_2 (
Union
[ndarray
,Tensor
]) -- Some data with at least 1 dimension.
- Return type
Tensor
- Returns
The distance.
- class ecgan.utils.distances.MinkowskiDistance(order=3, reduction='none')[source]
Bases:
ecgan.utils.distances.DistanceMetric
Implementation of the Minkowski distance of two vectors.
p=1: Manhattan Distance, p=2: Euclidean distance. Default is p=3.
- class ecgan.utils.distances.L1Distance(reduction='none')[source]
Bases:
ecgan.utils.distances.DistanceMetric
Implementation of the \(L_1\)-distance.
- class ecgan.utils.distances.L2Distance(reduction='none')[source]
Bases:
ecgan.utils.distances.DistanceMetric
Implementation of the \(L_2\)-distance.
- class ecgan.utils.distances.RGANMedianPairwiseDistance[source]
Bases:
ecgan.utils.distances.DistanceMetric
Based on the tensorflow implementation from https://github.com/ratschlab/RGAN/blob/master/mmd.py.
Wsed as a heuristic for the RBF bandwidth.