niteshade.defence.Distance_metric
- class niteshade.defence.Distance_metric(type='Eucleidian')
Bases:
object
A Distance_metric class for the feasibleset defender. Allows to define custom distance metrics for feasibleset defender distance calculation. For user implemented custom Distance_metric objects, need to have a .distance method where a float is returned.
- Parameters
type (string) – The type of the distance metric. This will be returned for informative purposes when .distance_metric is called for feasibleset defender.
- __init__(type='Eucleidian') None
Constructor method of FeasibleSetDefender class. Default Distance_metric is Eucleidian distance.
Methods
__init__
([type])Constructor method of FeasibleSetDefender class.
distance
(input_1, Input_2)Calculates the distance between 2 input points
- distance(input_1, Input_2)
- Calculates the distance between 2 input points
Currently only Eucleidian (l2 norm) distance metric is implemented off-the-shelf
- Parameters
input_1 (np.ndarray) – point_1 data (shape data dimensionality).
input_2 (np.ndarray) – point_2 data (shape data dimensionality).
- Returns
distance between the 2 input points.
- Return type
distance (float)