inFairness.distances.euclidean_dists module#

class inFairness.distances.euclidean_dists.EuclideanDistance[source]#

Bases: Distance

forward(x, y, itemwise_dist=True)[source]#

Subclasses must override this method to compute particular distances

Returns:

distance between two inputs

Return type:

Tensor

training: bool#
class inFairness.distances.euclidean_dists.ProtectedEuclideanDistance[source]#

Bases: Distance

fit(protected_attributes, num_attributes)[source]#

Fit Protected Euclidean Distance metric

Parameters:
  • protected_attributes (Iterable[int]) – List of attribute indices considered to be protected. The metric would ignore these protected attributes while computing distance between data points.

  • num_attributes (int) – Total number of attributes in the data points.

forward(x, y, itemwise_dist=True)[source]#
Parameters:

y (x,) – a B x D matrices

Returns:

B x 1 matrix with the protected distance camputed between x and y

to(device)[source]#

Moves distance metric to a particular device

Parameters:

device (torch.device) –

training: bool#