tapas.attacks.distances.LpDistance

class tapas.attacks.distances.LpDistance(p: float = 2, weights: Optional[numpy.array] = None)

Bases: tapas.attacks.distances.DistanceMetric

L_p distance between two datasets (typically, tabular datasets). This 1-hot encodes categorical attributes.

__init__(p: float = 2, weights: Optional[numpy.array] = None)
Parameters
  • p (float) – Order of the distance (default 2, Euclidean distance). p must be a positive number.

  • weights (real-valued numpy array) – Weighting to apply to individual entries in the 1-hot encoded dataset. The distance between records x and y (of length k) is computed as (sum_i weights_i * abs(x_i - y_i)^p )^(1/p).

  • of (Use the weights to restrict this distance to a specific subset) –

  • (e.g. (variables) –

  • columns). (to exclude 1-hot encoded) –

Methods

__init__([p, weights])

param p

Order of the distance (default 2, Euclidean distance). p must be

Attributes

label